码迷,mamicode.com
首页 > Web开发 > 详细

kubernetes

时间:2019-04-03 19:22:08      阅读:216      评论:0      收藏:0      [点我收藏+]

标签:ORC   update   clust   https   http   tco   info   source   pods   

v1.14

所有机器:

swapoff -a

apt-get install docker.io

 

apt-get update && apt-get install -y apt-transport-https curl
curl -s https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
cat <<EOF >/etc/apt/sources.list.d/kubernetes.list
deb https://apt.kubernetes.io/ kubernetes-xenial main
EOF
apt-get update
apt-get install -y kubelet kubeadm kubectl
apt-mark hold kubelet kubeadm kubectl

systemctl enable docker.service

 

master上执行:

kubeadm init --kubernetes-version=v1.14.0 --pod-network-cidr=10.244.0.0/16 --service-cidr=10.96.0.0/12 --apiserver-advertise-address=0.0.0.0

mkdir -p $HOME/.kube                      #这样执行kubectl get cs不会报错

cp -i /etc/kubernetes/admin.conf ~/.kube/config            #这样执行kubectl get cs不会报错,get cs == get compontsstatuses 验证其各组件的运行是否正常。

 

 

验证:

kubectl get cs    #get cs == get compontsstatuses 验证其各组件的运行是否正常。

NAME                 STATUS    MESSAGE             ERROR

scheduler            Healthy   ok                  

controller-manager   Healthy   ok                  

etcd-0               Healthy   {"health":"true"} 

 

安装flannel网络:

kubectl apply -f https://raw.githubusercontent.com/coreos/flannel/a70459be0084506e4ec919aa1c114638878db11b/Documentation/kube-flannel.yml

 验证:

kubectl get nodes会变成Ready状态

 

 kubectl get pods -n kube-system| grep flannel  #也会显示Running

 

获取集群状态信息:

 

kubectl cluster-info

Kubernetes master is running at https://192.168.204.13:6443

KubeDNS is running at https://192.168.204.13:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

 

To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump‘.

 

 

 

kubectl version

Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:45:25Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}

 

 

 

 

kubectl version --short=true

Client Version: v1.14.0

Server Version: v1.14.0

 

集群重置:

kubeadm reset

 

查看所有集群:

kubectl get nodes

 

从集群移除节点:

master上执行:

kubectl drain NODE_ID --delete-local-data --force --ignore-daemonsets

kubectl delete node NODE_ID

node上执行:

kubeadm reset

 

kubernetes

标签:ORC   update   clust   https   http   tco   info   source   pods   

原文地址:https://www.cnblogs.com/alexhjl/p/10650876.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!