k8s部署-18-叢集測試

k8s部署-18-叢集測試

透過這幾篇文章,相信我們已經透過kubernetes-the-hard-way的方式,將k8s叢集搭建成功了,那麼如何進行驗證呢?無非就是新建一個daemonset嘛,然後透過檢測各種網路連通性驗證,那麼話不多說,直接來實操吧。

k8s部署-18-叢集測試

新建nginx的yaml檔案

# 建立配置檔案[root@node1 ~]# cat > nginx-ds。yml <

檢查IP地址連通性

# 獲取到pod的IP地址[root@node1 ~]# kubectl get pod -o wideNAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATESnginx-ds-m8wrf 1/1 Running 0 2m31s 10。200。135。3 node3 nginx-ds-zc5qt 1/1 Running 0 2m31s 10。200。104。2 node2 [root@node1 ~]# # 分別在node2和node3這兩個worker節點上ping一下[root@node2 ~]# ping 10。200。135。3[root@node2 ~]# ping 10。200。104。2[root@node3 ~]# ping 10。200。135。3[root@node3 ~]# ping 10。200。104。2# 檢查svc的可達性[root@node1 ~]# kubectl get svcNAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGEkubernetes ClusterIP 10。233。0。1 443/TCP 22hnginx-ds NodePort 10。233。127。233 80:30323/TCP 4m12s[root@node1 ~]# # 獲取到IP為10。233。127。233# 然後在worker節點上分別curl一下,看看是否成功返回nginx介面。[root@node2 ~]# curl 10。233。127。233<!DOCTYPE html>Welcome to nginx!

Welcome to nginx!

If you see this page, the nginx web server is successfully installed andworking。 Further configuration is required。

For online documentation and support please refer tonginx。org
Commercial support is available atnginx。com

Thank you for using nginx。

[root@node2 ~]# # 再檢查透過node的IP地址是否能通,使用如下命令,在worker節點上執行[root@node2 ~]# curl 10。200。135。3:80[root@node2 ~]# curl 10。200。104。2:80

檢查dns

# 建立一個nginx的pod[root@node1 ~]# cat > pod-nginx。yaml <

日誌功能

剩餘內容請轉至VX公眾號 “運維家” ,回覆 “125” 檢視。