k8s v1.14集群验证

验证集群功能

检查节点状态

1
2
3
4
5
# kubectl get nodes
NAME STATUS ROLES AGE VERSION
172.21.16.204 Ready <none> 5h50m v1.14.6
172.21.16.240 Ready <none> 5h48m v1.14.6
172.21.16.87 Ready <none> 5h45m v1.14.6

都为 Ready 时正常。

创建测试文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# cat nginx-ds.yml 
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: extensions/v1beta1
kind: DaemonSet
metadata:
name: nginx-ds
labels:
addonmanager.kubernetes.io/mode: Reconcile
spec:
template:
metadata:
labels:
app: nginx-ds
spec:
containers:
- name: my-nginx
image: nginx:1.7.9
ports:
- containerPort: 80

# kubectl create -f nginx-ds.yml

检查各节点的 Pod IP 连通性

1
2
3
4
# kubectl get pods  -o wide|grep nginx-ds
nginx-ds-9fb46 1/1 Running 0 5h2m 172.30.232.2 172.21.16.204 <none> <none>
nginx-ds-bgfzt 1/1 Running 0 5h2m 172.30.128.2 172.21.16.87 <none> <none>
nginx-ds-t22wj 1/1 Running 0 5h2m 172.30.176.2 172.21.16.240 <none> <none>

检查服务 IP 和端口可达性

1
2
# kubectl get svc |grep nginx-ds
nginx-ds NodePort 10.254.232.104 <none> 80:30349/TCP 5h2m

在浏览器在30349进行访问可以看到neinx的欢迎界面

坚持原创技术分享,您的支持将鼓励我继续创作!
0%