linux怎么查看本机内存大小
283
2022-09-12
k8s部署-18-集群测试
通过这几篇文章,相信我们已经通过kubernetes-the-hard-way的方式,将k8s集群搭建成功了,那么如何进行验证呢?无非就是新建一个daemonset嘛,然后通过检测各种网络连通性验证,那么话不多说,直接来实操吧。
新建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
If you see this page, the nginx web server is successfully installed andworking. Further configuration is required.
For online documentation and support please refer to
[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 <
日志功能
# 查看现在有的pod[root@node1 ~]# kubectl get podNAME READY STATUS RESTARTS AGEnginx 1/1 Running 0 3m55snginx-ds-m8wrf 1/1 Running 0 12mnginx-ds-zc5qt 1/1 Running 0 12m[root@node1 ~]# # 可以看到现在有3个pod,我们随机选择一个,查看下日志[root@node1 ~]# kubectl logs nginx/docker-entrypoint.sh: /docker-entrypoint.d/ is not empty, will attempt to perform configuration/docker-entrypoint.sh: Looking for shell scripts in /docker-entrypoint.d//docker-entrypoint.sh: Launching /docker-entrypoint.d/10-listen-on-ipv6-by-default.sh10-listen-on-ipv6-by-default.sh: info: Getting the checksum of /etc/nginx/conf.d/default.conf10-listen-on-ipv6-by-default.sh: info: Enabled listen on IPv6 in /etc/nginx/conf.d/default.conf/docker-entrypoint.sh: Launching /docker-entrypoint.d/20-envsubst-on-templates.sh/docker-entrypoint.sh: Launching /docker-entrypoint.d/30-tune-worker-processes.sh/docker-entrypoint.sh: Configuration complete; ready for start up2022/03/20 12:14:04 [notice] 1#1: using the "epoll" event method2022/03/20 12:14:04 [notice] 1#1: nginx/1.21.62022/03/20 12:14:04 [notice] 1#1: built by gcc 10.2.1 20210110 (Debian 10.2.1-6) 2022/03/20 12:14:04 [notice] 1#1: OS: Linux 3.10.0-862.el7.x86_642022/03/20 12:14:04 [notice] 1#1: getrlimit(RLIMIT_NOFILE): 1048576:10485762022/03/20 12:14:04 [notice] 1#1: start worker processes2022/03/20 12:14:04 [notice] 1#1: start worker process 31[root@node1 ~]#
exec功能
[root@node1 ~]# kubectl get pods -l app=nginx-dsNAME READY STATUS RESTARTS AGEnginx-ds-m8wrf 1/1 Running 0 13mnginx-ds-zc5qt 1/1 Running 0 13m[root@node1 ~]# [root@node1 ~]# kubectl get pods -lError: flag needs an argument: 'l' in -lSee 'kubectl get --help' for usage.[root@node1 ~]# kubectl get pods -l app=nginx-dsNAME READY STATUS RESTARTS AGEnginx-ds-m8wrf 1/1 Running 0 13mnginx-ds-zc5qt 1/1 Running 0 13m[root@node1 ~]# kubectl exec -it nginx-ds-m8wrf -- nginx -vnginx version: nginx/1.21.6[root@node1 ~]#
至此,我们的k8s集群也验证完毕了,恭喜下自己吧。
版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。
发表评论
暂时没有评论,来抢沙发吧~