码迷,mamicode.com
首页 > Web开发 > 详细

017.Kubernetes二进制部署检查集群

时间:2019-11-18 18:50:32      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:data-   orm   type   title   code   border   二进制   boa   play   

一 验证集群功能

1.1 检查节点状态

  1 [root@k8smaster01 ~]# kubectl get nodes
技术图片

1.2 创建测试文件

  1 [root@k8smaster01 ~]# cd /opt/k8s/work
  2 [root@k8smaster01 work]# cat > nginx-ds.yml <<EOF
  3 apiVersion: v1
  4 kind: Service
  5 metadata:
  6   name: nginx-ds
  7   labels:
  8     app: nginx-ds
  9 spec:
 10   type: NodePort
 11   selector:
 12     app: nginx-ds
 13   ports:
 14   - name: http
 15     port: 80
 16     targetPort: 80
 17 ---
 18 apiVersion: extensions/v1beta1
 19 kind: DaemonSet
 20 metadata:
 21   name: nginx-ds
 22   labels:
 23     addonmanager.kubernetes.io/mode: Reconcile
 24 spec:
 25   template:
 26     metadata:
 27       labels:
 28         app: nginx-ds
 29     spec:
 30       containers:
 31       - name: my-nginx
 32         image: nginx:1.7.9
 33         ports:
 34         - containerPort: 80
 35 EOF
 36 [root@k8smaster01 work]# kubectl create -f nginx-ds.yml
技术图片

1.3 检查各节点的 Pod IP 连通性

  1 [root@k8smaster01 ~]# kubectl get pods  -o wide|grep nginx-ds
技术图片
  1 [root@k8smaster01 ~]# source /opt/k8s/bin/environment.sh
  2 [root@k8smaster01 ~]# for all_ip in ${ALL_IPS[@]}
  3   do
  4     echo ">>> ${all_ip}"
  5     ssh ${all_ip} "ping -c 1 172.30.240.2"
  6     ssh ${all_ip} "ping -c 1 172.30.248.2"
  7     ssh ${all_ip} "ping -c 1 172.30.144.2"
  8     ssh ${all_ip} "ping -c 1 172.30.192.2"
  9     ssh ${all_ip} "ping -c 1 172.30.136.2"
 10   done
 11 

1.4 检查服务 IP 和端口可达性

  1 [root@k8smaster01 ~]# kubectl get svc |grep nginx-ds
  2 nginx-ds     NodePort    10.254.168.17   <none>        80:32760/TCP   34m
  3 [root@k8smaster01 ~]# source /opt/k8s/bin/environment.sh
  4 [root@k8smaster01 ~]# for node_ip in ${NODE_IPS[@]}
  5   do
  6     echo ">>> ${node_ip}"
  7     ssh ${node_ip} "curl -s 10.254.168.17"
  8   done
  9 
技术图片
解释:
Service Cluster IP:10.254.168.17
服务端口:80
NodePort 端口:32760

1.5 检查服务的 NodePort 可达性

  1 [root@k8smaster01 ~]# source /opt/k8s/bin/environment.sh
  2 [root@k8smaster01 ~]# for node_ip in ${NODE_IPS[@]}
  3   do
  4     echo ">>> ${node_ip}"
  5     ssh ${node_ip} "curl -s ${node_ip}:32760"
  6   done
技术图片

017.Kubernetes二进制部署检查集群

标签:data-   orm   type   title   code   border   二进制   boa   play   

原文地址:https://www.cnblogs.com/itzgr/p/11883450.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!