通过这几篇文章,相信我们已经通过kubernetes-the-hard-way的方式,将k8s集群搭建成功了,那么如何进行验证呢?无非就是新建一个daemonset嘛,然后通过检测各种网络连通性验证,那么话不多说,直接来实操吧。
新建nginx的yaml文件
# 建立配置文件 [root@node1 ~]# cat > nginx-ds.yml <检查IP地址连通性
# 获取到pod的IP地址 [root@node1 ~]# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-ds-m8wrf 1/1 Running 0 2m31s 10.200.135.3 node3nginx-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 svc NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE kubernetes ClusterIP 10.233.0.1 443/TCP 22h nginx-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 Welcome to nginx! html { color-scheme: light dark; } body { width: 35em; margin: 0 auto; font-family: Tahoma, Verdana, Arial, sans-serif; } Welcome to nginx! If you see this page, the nginx web server is successfully installed and working. Further configuration is required.
For online documentation and support please refer to nginx.org.
Commercial support is available at nginx.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” 查看。



