$ k create -f kubia-svc.yaml 130 ↵
service/kubia created
$ k get all
NAME READY STATUS RESTARTS AGE
pod/kubia-77bv5 1/1 Running 0 10m
pod/kubia-m89k7 1/1 Running 0 10m
pod/kubia-wwkmh 1/1 Running 0 10m
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
service/kubia ClusterIP 172.22.2.238 <none> 80/TCP 5m39s
NAME DESIRED CURRENT READY AGE
replicaset.apps/kubia 3 3 3 10m
# k get svc 130 ↵
NAME TYPE CLUSTER-IP EXTERNAL-IP PORT(S) AGE
kubia ClusterIP 172.22.2.238 <none> 80/TCP 145m
kubia-nodeport NodePort 172.22.9.134 <none> 80:30123/TCP 21m
# k get node
NAME STATUS ROLES AGE VERSION
cn-hongkong.10.32.100.46 Ready <none> 7d4h v1.14.8-aliyun.1
cn-hongkong.10.32.100.47 Ready <none> 4d3h v1.14.8-aliyun.1
cn-hongkong.10.32.100.48 Ready <none> 2d23h v1.14.8-aliyun.1
这里稍稍复杂一些,我们启动了一个busybox的pod来测试内网端口
$ kubectl run busybox --rm -i --tty --image busybox -- sh
# 然后使用wget测试
wget -O- http://10.32.100.48:<30123换成你自己的端口30XXX>
$ k create -f kubia-rc-readinessprobe.yaml
replicationcontroller/kubia created
$ k get all 130 ↵
NAME READY STATUS RESTARTS AGE
pod/kubia-7268z 0/1 Running 0 86s
pod/kubia-czvm6 0/1 Running 0 86s
pod/kubia-r9q55 0/1 Running 0 86s
NAME DESIRED CURRENT READY AGE
replicationcontroller/kubia 3 3 0 86s
能看到全都没有提供服务,没有进入READY状态,我们进入一个pod满足它,然后再看状态
$ kubectl exec kubia-7268z -- touch /var/ready
$ k get all
NAME READY STATUS RESTARTS AGE
pod/kubia-7268z 1/1 Running 0 3m12s
pod/kubia-czvm6 0/1 Running 0 3m12s
pod/kubia-r9q55 0/1 Running 0 3m12s
NAME DESIRED CURRENT READY AGE
replicationcontroller/kubia 3 3 1 3m12s