9、docker+k8s+kubesphere:Kubernetes安装(2020-08-02更新)
9、docker+k8s+kubesphere:Kubernetes安装官网说明一定详细查看https://github.com/kubesphere/ks-installer/blob/master/README_zh.md官网说明一定详细查看https://kubesphere.io/docs/zh-CN/installation/prerequisites/yaml安装https://git
·
9、docker+k8s+kubesphere:Kubernetes安装
官网说明一定详细查看(本文用的是2.1.1)
https://github.com/kubesphere/ks-installer/blob/master/README_zh.md
https://github.com/kubesphere/ks-installer/blob/v2.1.1/README_zh.md
官网说明一定详细查看
https://kubesphere.io/docs/zh-CN/installation/prerequisites/
https://kubesphere.io/docs/zh-CN/installation/install-on-k8s/
yaml安装
https://github.com/kubesphere/ks-installer
拷贝里面的kubesphere-minimal.yaml文件
vim kubesphere-minimal.yaml
粘贴官网的的yaml的内容
执行
kubectl apply -f kubespher-minimal.yaml
执行结果如下
[root@node151 ~]# kubectl apply -f kubesphere-minimal.yaml
namespace/kubesphere-system created
configmap/ks-installer created
serviceaccount/ks-installer created
clusterrole.rbac.authorization.k8s.io/ks-installer created
clusterrolebinding.rbac.authorization.k8s.io/ks-installer created
deployment.apps/ks-installer created
查看kubesphere日志
kubectl logs -n kubesphere-system $(kubectl get pod -n kubesphere-system -l app=ks-install -o jsonpath='{.items[0].metadata.name}') -f
监控kubesphere的pod
watch kubectl get pods -n kubesphere-system -o wide
监控所有pod
watch kubectl get pods --all-namespaces -o wide
整个过程一小时左右,根据服务器,网速情况而定
查看pod
kubectl get pod --all-namespaces
[root@node151 ~]# kubectl get pod --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default nfs-client-provisioner-5cf8c79ff9-jhbmx 1/1 Running 1 8d
kube-system calico-kube-controllers-589b5f594b-ckfgz 1/1 Running 2 8d
kube-system calico-node-msd6f 1/1 Running 2 8d
kube-system calico-node-s9xf6 1/1 Running 3 8d
kube-system calico-node-wcztl 1/1 Running 2 8d
kube-system coredns-7f9c544f75-gmclr 1/1 Running 3 8d
kube-system coredns-7f9c544f75-t7jh6 1/1 Running 3 8d
kube-system etcd-node151 1/1 Running 5 8d
kube-system kube-apiserver-node151 1/1 Running 7 8d
kube-system kube-controller-manager-node151 1/1 Running 9 8d
kube-system kube-proxy-5t7jg 1/1 Running 4 8d
kube-system kube-proxy-fqjh2 1/1 Running 3 8d
kube-system kube-proxy-mbxtx 1/1 Running 3 8d
kube-system kube-scheduler-node151 1/1 Running 10 8d
kube-system tiller-deploy-797955c678-htwxb 1/1 Running 1 8d
kubesphere-system ks-installer-75b8d89dff-5jdbj 1/1 Running 1 8d
这里有一个kubesphere-system的pod,所有的pod都需要Running状态,如果服务器配置比较差,估计慢点或者会出问题
查看kubesphere
kubectl describe pod ks-installer-75b8d89dff-5jdbj -n kubesphere-system
结果如下
[root@node151 ~]# kubectl describe pod ks-installer-75b8d89dff-5jdbj -n kubesphere-system
Name: ks-installer-75b8d89dff-5jdbj
Namespace: kubesphere-system
Priority: 0
Node: node153/192.168.5.153
Start Time: Sat, 25 Jul 2020 01:42:42 +0800
Labels: app=ks-install
pod-template-hash=75b8d89dff
Annotations: cni.projectcalico.org/podIP: 10.20.235.9/32
Status: Running
IP: 10.20.235.9
IPs:
IP: 10.20.235.9
Controlled By: ReplicaSet/ks-installer-75b8d89dff
Containers:
installer:
Container ID: docker://31dcc870d139f8d280e9bfc77e490dbb0efef28dbde7e8a2771c23cc0296eee1
Image: kubesphere/ks-installer:v2.1.1
Image ID: docker-pullable://kubesphere/ks-installer@sha256:c3c62542a36ebb1c885d724dc2b0328cd78f9b27322393bd9c03a08b27db7e28
Port: <none>
Host Port: <none>
State: Running
Started: Sun, 02 Aug 2020 13:35:28 +0800
Last State: Terminated
Reason: Error
Exit Code: 255
Started: Sat, 25 Jul 2020 01:43:30 +0800
Finished: Sun, 02 Aug 2020 13:34:19 +0800
Ready: True
Restart Count: 1
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from ks-installer-token-pm9wj (ro)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
ks-installer-token-pm9wj:
Type: Secret (a volume populated by a Secret)
SecretName: ks-installer-token-pm9wj
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal SandboxChanged 20m (x2 over 20m) kubelet, node153 Pod sandbox changed, it will be killed and re-created.
Normal Pulling 20m kubelet, node153 Pulling image "kubesphere/ks-installer:v2.1.1"
Normal Pulled 19m kubelet, node153 Successfully pulled image "kubesphere/ks-installer:v2.1.1"
Normal Created 19m kubelet, node153 Created container installer
Normal Started 19m kubelet, node153 Started container installer
重装kubesphere
查看所有的pod
kubectl get pod --all-namespaces #复制name
执行
kubectl delete pod ks-installer-75b8d89dff-xt2mj -n kubesphere-system
执行结果如下:
[root@node151 ~]# kubectl delete pod ks-installer-75b8d89dff-xt2mj -n kubesphere-system
pod "ks-installer-75b8d89dff-5jdbj" deleted
执行
kubectl delete ns kubesphere-system
结果如下
[root@node151 ~]# kubectl delete ns kubesphere-system
namespace "kubesphere-system" deleted
磁盘使用情况
[root@node151 ~]# df -T -h
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs tmpfs 5.7G 0 5.7G 0% /dev/shm
tmpfs tmpfs 5.7G 21M 5.7G 1% /run
tmpfs tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 77G 3.6G 74G 5% /
/dev/sda1 xfs 1014M 193M 822M 19% /boot
tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/784825f89e644f454ecff60f7cbb8936ed7ebb823c660ad08150c3ff6c09d92c/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/b9db8a83334ba6ffa226303486d7161cc71c09001eb0f6ea0e4a9cf15eeaeb9c/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/12c948b03ec1d17a1c09fc1c4ce4ec48bf7a53ebf796dbd8ea9ed5b4aeb2b982/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/cda9568992b26f0ea401dc82c81ef9dade1efd0df1ed79d18ff3e82bd870fc56/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/5799e17805cdbb3e4dfe686338e6f0d8ff340bd209c46312b79915a3fa192643/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/621ee386047ff30ff3c2c57db3efa0378df60b42bec1063e7b6f3d2d8b584a5a/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/71079d307ae789fff30e6d8cf7b37bcce6c5bd7c80a89f3f2edd2603d1ea50c4/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/cd9f5f902cde6f119e6075174129da912949177a619600d6408af89f86a23ede/mounts/shm
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/331b5b0e3b1b09b98f4b93984d82da948fff7b82dea24f345c6879aa6516db35/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/5a30575d9319172178f47302d80525f247c5775e597ba76f0c52c3e5beee4d0f/merged
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/066127e9-7487-4c85-8a32-dfae882219a7/volumes/kubernetes.io~secret/coredns-token-sssw7
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/7fd78368-8d4d-47bd-8710-68eb7fc09462/volumes/kubernetes.io~secret/kube-proxy-token-vvl2k
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/8caa67b6-4862-4a52-9897-0c907fa042a0/volumes/kubernetes.io~secret/calico-node-token-8xp4l
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/7880159fb5c0abb56d2461c343977bb3e1dead5fd4e8069cc381334c690683c4/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/204090d69a8960e76cf839937d22f7d70c23463e18e6660d65196c9f84b1a02c/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/4abe2aad6a24a530a0c1496447e481f19ea705186fb0d06e5f107c6c485f40a5/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/7d0125a2c6612aae7ae5ee189a62abc9a159c3637657c8f92d155c6fca343f8e/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/cc2f9a3e04effaa931e7e7f228947db4bcf46874df73cec1a3a7b9ffe5a78c74/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/0e81c73adaec5260c07f9d08cbb32846dc9e48a0795b69530afde9fee4382d93/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/b7065cc25a49c14d783d946b44ebee57afc50904745827d285fe4c4f5e2d6c41/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/297c0ba0fbf67b0f3182135c311c2a5a3580c5cf08ca6899425eafb6a0b02980/mounts/shm
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/9c20b2ba57e9af0c80a476abf2bfdab869708c15250d61e70d54ef4ae1b12992/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/cfb58b5a149be6b7c0bbd3b33058331a56c48ed8426f2562aace1b3e2f534e0c/merged
overlay overlay 77G 3.6G 74G 5% /var/lib/docker/overlay2/8da687c200c245780b152271775c24a7bebe969a033fdea256ecf5838a27d8b3/merged
[root@node152 ~]# df -T -h
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs tmpfs 5.7G 0 5.7G 0% /dev/shm
tmpfs tmpfs 5.7G 29M 5.7G 1% /run
tmpfs tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 77G 2.9G 75G 4% /
/dev/sda1 xfs 1014M 193M 822M 19% /boot
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/eb56f4a5-8fd4-4f7a-8366-253c1b603267/volumes/kubernetes.io~secret/calico-node-token-8xp4l
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/1ae20b25-ba79-4112-87f5-26eb3e36d9ce/volumes/kubernetes.io~secret/kube-proxy-token-vvl2k
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/084bae30ffd1ffced37738f2aebbdc1e8cab17ecdb64c19a3be28b39ad7dbb70/merged
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/b43d477f7025e4adc1159ff0ac2743a84601e87636d7f876ca2c6f5b2b8abcc0/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/ff0bb58d6f7dac37922331ba1d46f6cc71e76fe56c82ec567ce3ac39acf4ab44/mounts/shm
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/c1b455138f413512f3e6f564987f6765bbb0cba0b72662868b060dd12a95859c/mounts/shm
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/7f2216030c982b37808f38c2eeb73160d37cd16a66a46e668e5ba8f36c41a593/merged
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/b4346c42dd09fc202210b182f48091d55e20540b89446ddd948941460ec398b1/merged
tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/c80f134d-086d-41ec-8702-a493ca283c13/volumes/kubernetes.io~secret/tiller-token-wsncc
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/283a380aaddf947d3f1feb2746a0374e50545f31dfe7b92ea83a7d310352d746/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/4b75c922caf25ccef6ea0128de6739bd4d6f88d03990a447f3e7997393c44208/mounts/shm
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/89f2a4100f34912a5593444cb62c1c36bacc93a2ec2a14d491507672ec57fc28/merged
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/7908f773-3bda-46e1-bc44-d4c7cec884ef/volumes/kubernetes.io~secret/nfs-provisioner-token-wvcjd
192.168.5.151:/data nfs4 77G 3.6G 74G 5% /var/lib/kubelet/pods/7908f773-3bda-46e1-bc44-d4c7cec884ef/volumes/kubernetes.io~nfs/nfs-client
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/d2988ff627bddf8bb90cfd5c2156e2684f3b4397e06c1693f976f90b01059af1/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/3a7a83b00b53ee0762cb824645bf2007e03077c1d92f126b69b0a852197a2e7e/mounts/shm
overlay overlay 77G 2.9G 75G 4% /var/lib/docker/overlay2/30f13791b5f5e88c38b8ac1e0ce09c87e89b896b582c7aea751f9621a4703fdb/merged
[root@node153 ~]# df -T -h
文件系统 类型 容量 已用 可用 已用% 挂载点
devtmpfs devtmpfs 5.7G 0 5.7G 0% /dev
tmpfs tmpfs 5.7G 0 5.7G 0% /dev/shm
tmpfs tmpfs 5.7G 21M 5.7G 1% /run
tmpfs tmpfs 5.7G 0 5.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root xfs 77G 3.4G 74G 5% /
/dev/sda1 xfs 1014M 193M 822M 19% /boot
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/8cec3cb3-9bb1-4f41-9cdd-f75f04f0e996/volumes/kubernetes.io~secret/calico-kube-controllers-token-cxgs8
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/b4b55812-6aa4-43f2-8790-f9a39025e697/volumes/kubernetes.io~secret/coredns-token-sssw7
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/8e2a90f8-0930-4c94-9348-1d3a4d6b58b1/volumes/kubernetes.io~secret/kube-proxy-token-vvl2k
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/da373248-f3ad-4ed6-9126-212562091ba9/volumes/kubernetes.io~secret/calico-node-token-8xp4l
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/3922cbbb6c5480bf3b3c89f30fe66dcf812edd19a5289570a630357784b2f2d7/merged
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/eea507f517189d3cfb074b4209227b4d54d8dc7f47c8af7c27693e66f967d1f8/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/9cad16e85c78fa4e676e634b303fd63c1a23e598ed4bb9da7524418fe6a7cc11/mounts/shm
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/22b7e87887d50d72213dbb8ed6e721fb308d4ede444d7ec0a27f252220360e18/mounts/shm
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/0343048c3ace3bf422da1382cc57e1a3d26ee55c5e2c941728559259a00d915b/merged
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/7a51dfdd10cfe5bc0a4c8bd040b42d1d38ef0429d4053ea35c6b21c5614474ef/merged
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/6f72465c98eacb25f0af408a9f572a2cbe58f2fe20a070fdf5d01b12577d9036/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/ab3f598923acf709d9f7f84152dd82c4cd6010b4bc5f78dede5fdeb655a03fdd/mounts/shm
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/d3c9d5420d5c9437e59838ef74dc384fa19da373c1029a1b9e02c5182aba8b28/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/d172cb0fbe75e18907e28d5e91b99a221e6132ee1f1e2ef10d9e5d69654f0e42/mounts/shm
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/749c79299a776dbe0f04f51f641839df6ecd56b5eb5ebb878952fea3a575b4dd/merged
tmpfs tmpfs 1.2G 0 1.2G 0% /run/user/0
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/df9ecd84e78181e958629d06e0be686fb1e89f5c10e22608029b7563e4ea537a/merged
tmpfs tmpfs 5.7G 12K 5.7G 1% /var/lib/kubelet/pods/58079662-ea95-43d0-8e29-f40545a6b95b/volumes/kubernetes.io~secret/ks-installer-token-pm9wj
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/56d02a16238a43aa184e9284bb8c79aa17f65e359fbb1b6708a915b05e22fb9d/merged
shm tmpfs 64M 0 64M 0% /var/lib/docker/containers/5b7b24bbb5cd826eb300462941edfaa776ffca2ea6eecf6678c220a09f012cc2/mounts/shm
overlay overlay 77G 3.4G 74G 5% /var/lib/docker/overlay2/3bd6a434f4740ed38d086f57425e93c816cd36ba2414495626141f3ddd0de138/merged
内存使用情况
[root@node151 ~]# free -h
total used free shared buff/cache available
Mem: 11G 1.1G 8.7G 20M 1.5G 9.9G
Swap: 0B 0B 0B
[root@node152 ~]# free -h
total used free shared buff/cache available
Mem: 11G 575M 9.6G 28M 1.1G 10G
Swap: 0B 0B 0B
[root@node153 ~]# free -h
total used free shared buff/cache available
Mem: 11G 617M 9.1G 28M 1.5G 10G
Swap: 0B 0B 0B
更多推荐
已为社区贡献1条内容
所有评论(0)