# 这时候查看pod状态 kubectl get pod NAME READY STATUS RESTARTS AGE myapp-pod 0/1 Init:0/2 0 3m42s
# 查看pod详情,可以看到创建pod成功,但是并没有继续执行下一步,原因是init容器命令并未执行成功 kubectl describe pod myapp-pod Name: myapp-pod Namespace: default Priority: 0 Node: k8s-node01/192.168.128.141 Start Time: Thu, 30 Jan 2020 15:51:03 +0800 Labels: app=myapp Annotations: <none> Status: Pending IP: 10.244.1.6 ... 中间省略 ... Events: Type Reason Age From Message ---- ------ ---- ---- ------- Normal Scheduled 59s default-scheduler Successfully assigned default/myapp-pod to k8s-node01 Normal Pulling 57s kubelet, k8s-node01 Pulling image "busybox" Normal Pulled 45s kubelet, k8s-node01 Successfully pulled image "busybox" Normal Created 45s kubelet, k8s-node01 Created container init-myservice Normal Started 44s kubelet, k8s-node01 Started container init-myservice
# 查看pod日志,可以看到nslookup执行不通过 kubectl log myapp-pod -c init-myservice log is DEPRECATED and will be removed in a future version. Use logs instead. Server: 10.96.0.10 Address: 10.96.0.10:53
** server can't find myservice.default.svc.cluster.local: NXDOMAIN
*** Can't find myservice.svc.cluster.local: No answer *** Can't find myservice.cluster.local: No answer *** Can't find myservice.default.svc.cluster.local: No answer *** Can't find myservice.svc.cluster.local: No answer *** Can't find myservice.cluster.local: No answer