一、组件方式检查

1. Master节点:

root>> kubectl get cs

2. Node 节点:

 二、服务方式检查

1. Master 节点:

root>> systemctl status etcd
root>> systemctl status kube-apiserver
root>> systemctl status kube-controller-manager
root>> systemctl status kube-scheduler

2. Node 节点

root>> systemctl status flanneld
root>> systemctl status kube-proxy
root>> systemctl status kubelet
root>> systemctl status docker

三、进程方式检查

1. Master 节点:

root>> ps -ef | grep etcd

root>> yum list installed | grep kube

2. Node 节点:

root>> ps -ef | grep flannel

root>> ps -ef | grep kube

四、安装包方式检查

1. Master 节点:

root>> yum list installed | grep etcd

root>> yum list installed | grep kube

2. Node 节点:

root>> yum list installed | grep flannel

root>> yum list installed | grep kube

五,附上第一次安装k8s集群失败后,后面重新安装k8s的一些环境重置的命令。

5.1 Master 节点
1. 卸载之前组件

[root@CNT7XDCK01 ~]# yum list installed | grep kube  #首先查询组件
kubernetes-client.x86_64                1.5.2-0.7.git269f928.el7       @extras  
kubernetes-master.x86_64                1.5.2-0.7.git269f928.el7       @extras  
[root@CNT7XDCK01 ~]# yum remove -y kubernetes-client.x86_64
[root@CNT7XDCK01 ~]# yum remove -y kubernetes-master.x86_64

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

3. 配置相关kube的配置文件

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

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"

编辑/etc/kubernetes/apiserver文件

###
# 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=""

4. 重新注册/启动/检查:组件的系统服务
[root@CNT7XDCK01 ~]# systemctl enable etcd
[root@CNT7XDCK01 ~]# systemctl enable kube-apiserver
[root@CNT7XDCK01 ~]# systemctl enable kube-controller-manager
[root@CNT7XDCK01 ~]# systemctl enable kube-scheduler

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

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

====================================================================

5.2 Node 节点
1. 卸载之前组件

[root@CNT7XDCK02 ~]# yum list installed | grep kube
kubernetes-client.x86_64             1.5.2-0.7.git269f928.el7          @extras  
kubernetes-node.x86_64               1.5.2-0.7.git269f928.el7          @extras
[root@CNT7XDCK02 ~]# yum remove -y kubernetes-client.x86_64
[root@CNT7XDCK02 ~]# yum remove -y kubernetes-node.x86_64

2. 重新安装组件
[root@CNT7XDCK02 ~]# yum -y install flannel
[root@CNT7XDCK02 ~]# yum -y install kubernetes-node

3. 配置相关kube的配置文件

修改/etc/sysconfig/flanneld文件

# Flanneld configuration options  

# etcd url location.  Point this to the server where etcd runs
FLANNEL_ETCD_ENDPOINTS="http://192.168.3.96:2379" # etcd config key. This is the configuration key that flannel queries
# For address range assignment
FLANNEL_ETCD_PREFIX="/atomic.io/network" # Any additional options that you want to pass
#FLANNEL_OPTIONS=""

修改/etc/kubernetes/config文件

###
# 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"

修改/etc/kubernetes/kubelet文件

###
# 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=""

4. 重新注册/启动/检查:组件的系统服务
[root@CNT7XDCK02 ~]# systemctl enable flanneld
[root@CNT7XDCK02 ~]# systemctl enable kube-proxy
[root@CNT7XDCK02 ~]# systemctl enable kubelet
[root@CNT7XDCK02 ~]# systemctl enable docker

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

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

六、最后,在Master机器,查看K8s安装结果

[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

如下,可以看到master拥有四个node节点机器,状态是Ready正常的。

K8s集群安装和检查(经验分享)的更多相关文章

  1. K8s集群安装--最新版 Kubernetes 1.14.1

    K8s集群安装--最新版 Kubernetes 1.14.1 前言 网上有很多关于k8s安装的文章,但是我参照一些文章安装时碰到了不少坑.今天终于安装好了,故将一些关键点写下来与大家共享. 我安装是基 ...

  2. [转帖]K8s集群安装--最新版 Kubernetes 1.14.1

    K8s集群安装--最新版 Kubernetes 1.14.1 http://www.cnblogs.com/jieky/p/10679998.html 原作者写的比较简单 大略流程和跳转的多一些 改天 ...

  3. K8S集群安装部署

    K8S集群安装部署   参考地址:https://www.cnblogs.com/xkops/p/6169034.html 1. 确保系统已经安装epel-release源 # yum -y inst ...

  4. Kubernetes(k8s)集群安装

    一:简介 二:基础环境安装 1.系统环境 os Role ip Memory Centos 7 master01 192.168.25.30 4G Centos 7 node01 192.168.25 ...

  5. K8s 集群安装(一)

    01,集群环境 三个节点   master node1 node2 IP 192.168.0.81 192.168.0.82 192.168.0.83 环境 centos 7 centos 7 cen ...

  6. 基于 K8S 集群安装部署 istio-1.2.4

    使用云平台可以为组织提供丰富的好处.然而,不可否认的是,采用云可能会给 DevOps 团队带来压力.开发人员必须使用微服务以满足应用的可移植性,同时运营商管理了极其庞大的混合和多云部署.Istio 允 ...

  7. install kubernetes cluster k8s集群安装

    一,安装docker-ce 17.031,下载rpm包 Wget -P /tmp https://mirrors.aliyun.com/docker-ce/linux/centos/7/x86_64/ ...

  8. kubernetes(k8s)集群安装calico

    添加hosts解析 cat /etc/hosts 10.39.7.51 k8s-master-51 10.39.7.57 k8s-master-57 10.39.7.52 k8s-master-52 ...

  9. k8s集群安装

    准备三台虚拟机,一台做master,两台做master节点,关闭selinux. 一.安装docker,两node节点上进行 1. 2.安装docker依赖包:yum install -y yum-u ...

随机推荐

  1. Android 性能优化的方面方面都在这儿

    又到周六了,鸿洋的不定期的周六放送又来了~~这次来谈谈性能优化吧.大家在工作中或多或少都会拿自家的应用和竞品app做比对,不可避免的需要做一些app性能优化的活.很多时候可能是策略上的调整,不过还是有 ...

  2. Bootstrap 在线引用

    Bootstrap 3.3.0 js 文件 <script src="http://cdn.bootcss.com/bootstrap/3.3.0/js/bootstrap.min.j ...

  3. Angular1.x 之Providers (Value, Factory, Service and Constant )

    官方文档Providers Each web application you build is composed of objects that collaborate to get stuff do ...

  4. Java Web高性能开发 - 前端高性能

    作者:IBM developerWorks链接:https://www.ibm.com/developerworks/cn/java/j-lo-javawebhiperf1/著作权归作者所有.商业转载 ...

  5. 打印 1 到最大的 n 位数(C++ 和 Python 实现)

    (说明:本博客中的题目.题目详细说明及参考代码均摘自 “何海涛<剑指Offer:名企面试官精讲典型编程题>2012年”) 题目 输入数字 n,按顺序打印出从 1 到最大的 n 位十进制数. ...

  6. int占几个字节?

    class Program19 { static void Main(string[] args) { // true,或false Console.WriteLine("bool占用:&q ...

  7. (七)Linux下的关机与重启命令

    ============================================================================================= 关机与重启命 ...

  8. python 中的set与list,tuple

    __author__ = 'liunnis' #-*-coding:utf-8 -*- a=[1,2,3,4,4] print a print list(set(a)) b=[str(i) for i ...

  9. unbuntu 14安装 golang

    golang目前有两种编译,一种是golang官方提供的,另外一个是gnu提供的gccgo.这里安装的是Golang,从仓库安装(apt-get)        sudo apt-get instal ...

  10. PHP-----TP框架----命名空间

    TP框架----命名空间 命名空间,起什么作用??? [1]命名空间是一个虚拟的目录,这个文件有可能存在这个电脑里的任何一个地方,但是如果要把这个文件它的命名空间全部写成同一个那么这些文件就相当于在同 ...