k8s高可用集群9集群的可用性驗證

2022-09-25 12:51:09 字數 3024 閱讀 7279

1檢視集群中所有namespace裡的容器。發現都是running狀態

[root@k8s-master01 ~]#kubectl get pod --all-namespaces

2檢視監控資料

[root@k8s-master01 ~]#kubectl top pod -n kube-system

3檢查跨網是否可以訪問pod

[root@k8s-master01 ~]#kubectl get pod --all-namespaces -o wide

namespace name ready status restarts age ip node nominated node readiness gates

kube-system calico-kube-controllers-6f6595874c-s9gz4 1/1 running 0 3h28m 172.25.244.194 k8s-master01 kube-system calico-node-b98mk 1/1 running 0 3h28m 10.0.0.205 k8s-master02 [root@k8s-master01 ~]#ping 10.0.0.205

ping

10.0.0.205 (10.0.0.205) 56(84

) bytes of data.

64 bytes from

10.0.0.205: icmp_seq=1 ttl=64 time=10.3

ms64 bytes from

10.0.0.205: icmp_seq=2 ttl=64 time=0.992

ms64 bytes from

10.0.0.205: icmp_seq=3 ttl=64 time=2.79

ms64 bytes from

10.0.0.205: icmp_seq=4 ttl=64 time=0.973

ms64 bytes from

10.0.0.205: icmp_seq=5 ttl=64 time=0.478 ms

4測試pod之間是不是通的

[root@k8s-master01 ~]#kubectl get pod --all-namespaces -o wide

namespace name ready status restarts age ip node nominated node readiness gates

kube-system calico-kube-controllers-6f6595874c-s9gz4 1/1 running 0 3h28m 172.25.244.194 k8s-master01 kube-system calico-node-b98mk 1/1 running 0 3h28m 10.0.0.202 k8s-master02 kube-system calico-node-nhch2 1/1 running 0 3h28m 10.0.0.205 k8s-node2 #在master01中進行node02的pod執行命令

[root@k8s-master01 ~]#kubectl exec -it calico-node-nhch2 -n kube-system /bin/sh

kubectl exec [pod] [command]

is deprecated and will be removed in a future version. use kubectl exec [pod] --[command] instead.

defaulted container

"calico-node

"out of: calico-node, upgrade-ipam (init), install-cni (init), flexvol-driver (init)

sh-4.4#

5要想外部訪問乙個應該,必須要暴漏乙個埠,例如

[root@k8s-master01 ~]#kubectl get svc -n kubernetes-dashboard

name type cluster-ip external-ip port(s) age

dashboard-metrics-scraper clusterip 192.168.223.247

8000/tcp 96m

kubernetes-dashboardnodeport192.168.202.76

443:32081/tcp 96m

[root@k8s-master01 ~]#kubectl edit svc kubernetes-dashboard

error

from server (notfound): services "

kubernetes-dashboard

"not found

[root@k8s-master01 ~]#kubectl edit svc kubernetes-dashboard -n !$

#修改此處為nodeport

k8s 高可用配置

多master nginx keepalived配置完成後。需要修改node連線apiserver位址 1 在每一台node節點中修改 root linux node2 cfg pwd opt kubernetes cfg 修改一下配置檔案位址我的虛擬vip192.168.56.17 bootstr...

K8S實戰DAY3 高可用集群測試

疑問建立nginx ds服務,檢查ip連通性,並建立nginxpod進入檢視dns可用性 寫入配置 eof 檢查各 node 上的 pod ip 連通性 kubectl get pods o wide 在每個節點上ping pod ip ping 檢查service可達性 root m1 kubec...

離線安裝k8s1 5高可用集群

經常遇到全新初始安裝k8s集群的問題,所以想著搞成離線模式,本著最小依賴原則,採用純shell指令碼編寫 基於centos7 1503 minimal執行指令碼測試ok,預設安裝docker1.12.3 etcd v3.0.15 k8s v1.5.1 本離線安裝所有的依賴都打包放到了網盤,不放心安全...