新浦京81707con > 功能介绍 > Kubernetes集群部署,K8s集群安装和检查

原标题:Kubernetes集群部署,K8s集群安装和检查

浏览次数:53 时间:2019-05-19

 

KUBELET_PORT="--kubelet-port=10250"

active

ETCD_NAME="default"
ETCD_DATA_DIR="/var/lib/etcd/default.etcd"
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://localhost:2379"

192.168.137.148 cmnode1

active

  1. 卸载在此以前组件

# systemctl status  kube-controller-manager.service

[root@k8s-node1 ~]# systemctl start kube-proxy.service kubelet.service 

编辑/etc/kubernetes/apiserver文件

192.168.137.199 cmnode2

systemctl disable firewalld

 

yum -y install flannel kubernetes-node

留神:运转顺序 etcd-->kubernetes*

修改/etc/kubernetes/kubelet文件

  - kube-controller-manager 确认保证集群服务

一.三.四 运转docker并参与开机自运维

###
# kubernetes kubelet (minion) config

# The address for the info server to serve on (set to 0.0.0.0 or "" for all interfaces)
KUBELET_ADDRESS="--address=0.0.0.0"

# The port for the info server to serve on
KUBELET_PORT="--port=10250"

# You may leave this blank to use the actual hostname
KUBELET_HOSTNAME="--hostname-override=192.168.3.97" # 这里是node机器的IP

# location of the api-server
KUBELET_API_SERVER="--api-servers=http://192.168.3.96:8080" # 这里是master机器的IP

# pod infrastructure container
KUBELET_POD_INFRA_CONTAINER="--pod-infra-container-image=registry.access.redhat.com/rhel7/pod-infrastructure:latest"

# Add your own!
KUBELET_ARGS=""

192.168.137.142 cmmaster

8:KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"

5.2 Node 节点

贰.为flannel互联网钦点etcd服务,修改/etc/sysconfig/flanneld文件

systemctl start flanneld.service

 

Kubernetes集群安装配置

[root@k8s-node1 ~]# systemctl is-active kube-proxy.service kubelet.service 

 

  Kubernetes职业情势server-client,Kubenetes Master提供聚集国化学工业进出口总公司管理迷你ons。

kube-scheduler.service                      disabled     #内需运行 

root>> ps -ef | grep kube

for SERVICES in etcd kube-apiserver kube-controller-manager kube-scheduler; do systemctl restart $SERVICES;systemctl enable $SERVICES;systemctl status $SERVICES ; done

#配置config

  1. 重新安装组件
    [root@CNT7XDCK01 ~]# yum -y install etcd
    [root@CNT7XDCK01 ~]# yum -y install kubernetes-master

1.安装flannel kubernetes-node

#controller-manager 

 

设置配置Kubernetes Node

[root@k8s-node1 kubernetes]# vim config 

root>> ps -ef | grep etcd

# systemctl status  etcd.service

Node2:

[root@CNT7XDCK01 ~]# systemctl restart etcd
[root@CNT7XDCK01 ~]# systemctl restart kube-apiserver
[root@CNT7XDCK01 ~]# systemctl restart kube-controller-manager
[root@CNT7XDCK01 ~]# systemctl restart kube-scheduler

-Master节点

service iptables save

  1. Master 节点:

192.168.137.199   Ready     7m

[root@k8s-master kubernetes]# vim  controller-manager 

[root@CNT7XDCK01 ~]# kubectl get nodes
NAME            STATUS    AGE
192.168.3.100   Ready     35d
192.168.3.97    Ready     35d
192.168.3.98    Ready     35d
192.168.3.99    Ready     35d

3.编辑/etc/kubernetes/apiserver文件

MASTER

图片 1

KUBE_LOGTOSTDERR="--logtostderr=true"

1.三 遭受筹划

###
# kubernetes system config
#
# The following values are used to configure the kube-apiserver
#

# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"

# The port on the local server to listen on.
KUBE_API_PORT="--port=8080"

# Port minions listen on
KUBELET_PORT="--kubelet-port=10250"

# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379"

# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"

# default admission control policies
# KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ServiceAccount,ResourceQuota"
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,SecurityContextDeny,ResourceQuota"

# Add your own!
KUBE_API_ARGS=""

Kubernetes集群组件:

[root@localhost ~]# uname -a

root>> yum list installed | grep kube

肆.开头etcd、kube-apiserver、kube-controller-manager、kube-scheduler等劳动,并安装开机启动。

Linux localhost.localdomain 3.10.0-514.6.1.el7.x86_64 #1 SMP Wed Jan 18 13:06:36 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

  1. Master节点:

  - etcd 一个高可用的K/V键值对存款和储蓄和劳动意识系统

-rw-r--r-- 1 root root 189 Jul  3 23:33 controller-manager #内需配置

root>> yum list installed | grep etcd

192.168.137.212 cmnode3

Master:

[root@CNT7XDCK02 ~]# systemctl status flanneld
[root@CNT7XDCK02 ~]# systemctl status kube-proxy
[root@CNT7XDCK02 ~]# systemctl status kubelet
[root@CNT7XDCK02 ~]# systemctl status docker

设置配备Kubernetes Master,在Master节点上

master创设 flannel所必要的互连网音讯:

图片 2

KUBE_ETCD_SERVERS="--etcd-servers="

[root@k8s-master ~]# systemctl start kube-apiserver.service kube-controller-manager.service  kube-scheduler.service  

修改/etc/kubernetes/config文件

-Minion节点

22:KUBE_MASTER="--master="

图片 3

ETCD_ADVERTISE_CLIENT_URLS=""

14:KUBELET_API_SERVER="--api-servers="

 

图片 4

active

图片 5

4.如约如下内容退换对应node的布局文件/etc/kubernetes/kubelet

total 24

 

设置EPEL源,在富有节点上

[root@k8s-master ~]# systemctl enable kube-apiserver.service kube-controller-manager.service  kube-scheduler.service

  1. 安顿相关kube的布置文件

2.编辑/etc/etcd/etcd.conf文件

11:KUBELET_HOSTNAME="--hostname-override=192.168.56.140"

  1. Node 节点:

KUBE_ALLOW_PRIV="--allow-privileged=false"

active

一、组件方式检查

[root@cmmaster ~]# etcdctl mk /atomic.io/network/config '{"Network":"172.17.0.0/16"}'

# apiserver

ETCD_NAME=default

systemctl enable iptables

 

1.使用yum安装etcd和kubernetes-master

192.168.56.150   Ready     54m

 

# yum -y install epel-release

[root@k8s-node1 sysconfig]# systemctl is-active flanneld.service

[root@CNT7XDCK02 ~]# systemctl restart flanneld
[root@CNT7XDCK02 ~]# systemctl restart kube-proxy
[root@CNT7XDCK02 ~]# systemctl restart kubelet
[root@CNT7XDCK02 ~]# systemctl restart docker

起步etcd、kube-apiserver、kube-controller-manager、kube-scheduler等劳务,并设置开机运转。

{ "Network": "172.17.0.0/16" }

root>> yum list installed | grep kube

部署1台Kubernetes Master节点和3台Minion节点,

SLAVE 四个节点一样

###
# kubernetes system config
#
# The following values are used to configure various aspects of all
# kubernetes services, including
#
#   kube-apiserver.service
#   kube-controller-manager.service
#   kube-scheduler.service
#   kubelet.service
#   kube-proxy.service
# logging to stderr means we get it in the systemd journal
KUBE_LOGTOSTDERR="--logtostderr=true"

# journal message level, 0 is debug
KUBE_LOG_LEVEL="--v=0"

# Should this cluster be allowed to run privileged docker containers
KUBE_ALLOW_PRIV="--allow-privileged=false"

# How the controller-manager, scheduler, and proxy find the apiserver
KUBE_MASTER="--master=http://192.168.3.96:8080"

# systemctl status  kube-scheduler.service

[root@k8s-master etcd]# systemctl start etcd

 

KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"

[root@k8s-master kubernetes]# vim apiserver 

  1. 卸载从前组件

  - kube-proxy 提供网络代理服务

-rw-r--r-- 1 root root 615 Jul  3 23:33 kubelet #需求配备

图片 6

KUBE_API_ARGS=""

9:ETCD_LISTEN_CLIENT_URLS=""

[root@CNT7XDCK01 ~]# systemctl status etcd
[root@CNT7XDCK01 ~]# systemctl status kube-apiserver
[root@CNT7XDCK01 ~]# systemctl status kube-controller-manager
[root@CNT7XDCK01 ~]# systemctl status kube-scheduler

集群暗意图

kubernetes

图片 7

# systemctl status  kube-apiserver.service

[root@k8s-master ~]# kubectl get node

  1. 配备相关kube的配备文件

# yum -y install etcd kubernetes-master

# kubelet

四、安装包格局检查

192.168.137.148   Ready     1m

#开机运行

本文由新浦京81707con发布于功能介绍,转载请注明出处:Kubernetes集群部署,K8s集群安装和检查

关键词: 新浦京81707con 实战 Kubernetes k8s

上一篇:产品经理逆天,微信产品经理推荐

下一篇:没有了