kubectl --kubeconfig meta/admin.kubeconfig.yaml get cluster
NAME CREATED AT
perf-test 11d
example-k8s-1 48d
...
kubectl --kubeconfig online/example-k8s-1/admin.kubeconfig.yaml get nodes | grep controller-manager
NAME READY STATUS RESTARTS AGE
example-controller-manager-786b4cc6d4-2bpdc 1/1 Running 0 4d
example-controller-manager-786b4cc6d4-9bjk6 1/1 Running 1 4d
example-controller-manager-786b4cc6d4-dfxhc 1/1 Running 1 4d
kubectl --kubeconfig meta/admin.kubeconfig.yaml -n example-k8s-1 describe pod example-controller-manager-786b4cc6d4-9bjk6
Name: example-controller-manager-786b4cc6d4-9bjk6
Namespace: example-k8s-1
...
Containers:
example-controller-manager: <=这个值就是容器名字
Container ID: ...
Image: ...
Image ID: ...
查询pod的容器信息方法: kubectl describe pod podname
kubectl --kubeconfig meta/admin.kubeconfig.yaml -n example-k8s-1 logs example-controller-manager-786b4cc6d4-9bjk6 -c example-controller-manager --previous
查询pod的指定容器日志语法是: kubectl logs podname -c containername --previous