k8s-kubeadm-集群可用性测试
1. 创建nginx ds
https://kubernetes.io/zh/docs/tasks/run-application/run-stateless-application-deployment/
# 写入配置 $ cat > nginx-ds.yml <<EOF apiVersion: v1 kind: Service metadata: name: nginx-ds labels: app: nginx-ds spec: type: NodePort selector: app: nginx-ds ports: - name: http port: 80 targetPort: 80 --- apiVersion: apps/v1 kind: Deployment metadata: name: nginx-ds spec: selector: matchLabels: app: nginx-ds replicas: 2 template: metadata: labels: app: nginx-ds spec: containers: - name: nginx image: nginx:1.16.1 # Update the version of nginx from 1.14.2 to 1.16.1 ports: - containerPort: 80 EOF # 创建ds $ kubectl create -f nginx-ds.yml
2. 检查各种ip连通性
# 检查各 Node 上的 Pod IP 连通性 $ kubectl get pods -o wide # 在每个节点上ping pod ip $ ping <pod-ip> # 检查service可达性 $ kubectl get svc # 在每个节点上访问服务 $ curl <service-ip>:<port> # 在每个节点检查node-port可用性 $ curl <node-ip>:<port>