pod
kubectl get pod -n my-namespace
kubectl get pod -n my-namespace gateway-7d6485b8f-sn9qn
kubectl get pod -n my-namespace gateway-7d6485b8f-sn9qn -o wide
缩减实例数
kubectl scale --replicas=2 deploy -n my-namespace gateway-7d6485b8f-sn9qn
查看端口映射
kubectl describe svc -n my-namespace yth-gateway
查看deploy
kubectl get deploy -n my-namespace
进入pod shell
kubectl exec -it -n my-namespace gateway-7d6485b8f-sn9qn sh
在标准输出显示pod最近50行日志,并实时刷新
kubectl logs -n my-namespace gateway-7d6485b8f-sn9qn --tail 50 -f
导出保存pod最近2小时的日志
kubectl logs -n my-namespace gateway-7d6485b8f-sn9qn --since 2h > log.log
获取pod状态
kubectl get pod
pod详细情况
kubectl describe pod elkhost-944bcbcd4-8n9nj
pod日志
kubectl logs elkhost-944bcbcd4-8n9nj
ReplicationController
kubectl get rc -n my-namespace
RS
查找pod
kubectl get pods -l environment=production,tier=frontend