kubectl命令中的POD和SERVICE是什么?

And*_*rew 2 kubernetes

我可能错过了一些基本的.kubectl logs命令用法如下:

"kubectl logs [-f] [-p] POD [-c CONTAINER] [options]"
Run Code Online (Sandbox Code Playgroud)

我的豆荚列表如下:

ubuntu@master:~$ kubectl get pods --all-namespaces
NAMESPACE     NAME                                    READY     STATUS             RESTARTS   AGE
kube-system   etcd-master                             1/1       Running            0          24m
kube-system   kube-apiserver-master                   1/1       Running            0          24m
kube-system   kube-controller-manager-master          1/1       Running            0          24m
kube-system   kube-discovery-982812725-3kt85          1/1       Running            0          24m
kube-system   kube-dns-2247936740-kimly               3/3       Running            0          24m
kube-system   kube-proxy-amd64-gwv99                  1/1       Running            0          20m
kube-system   kube-proxy-amd64-r08h9                  1/1       Running            0          24m
kube-system   kube-proxy-amd64-szl6w                  1/1       Running            0          14m
kube-system   kube-scheduler-master                   1/1       Running            0          24m
kube-system   kubernetes-dashboard-1655269645-x3uyt   1/1       Running            0          24m
kube-system   weave-net-4g1g8                         1/2       CrashLoopBackOff   7          14m
kube-system   weave-net-8zdm3                         1/2       CrashLoopBackOff   8          20m
kube-system   weave-net-qm3q5                         2/2       Running            0          24m
Run Code Online (Sandbox Code Playgroud)

我假设POD for logs命令是上面第二个"name"列中的任何内容.所以,我尝试以下命令.

ubuntu@master:~$ kubectl logs etcd-master
Error from server: pods "etcd-master" not found
ubuntu@master:~$ kubectl logs weave-net-4g1g8
Error from server: pods "weave-net-4g1g8" not found
ubuntu@master:~$ kubectl logs weave-net
Error from server: pods "weave-net" not found
ubuntu@master:~$ kubectl logs weave
Error from server: pods "weave" not found
Run Code Online (Sandbox Code Playgroud)

那么,logs命令中的POD是什么?

我也有关于服务的问题.如何识别要提供给命令的SERVICE,例如'describe'命令?

ubuntu@master:~$ kubectl get services --all-namespaces
NAMESPACE     NAME                   CLUSTER-IP      EXTERNAL-IP   PORT(S)         AGE
default       kubernetes             100.64.0.1      <none>        443/TCP         40m
kube-system   kube-dns               100.64.0.10     <none>        53/UDP,53/TCP   39m
kube-system   kubernetes-dashboard   100.70.83.136   <nodes>       80/TCP          39m

ubuntu@master:~$ kubectl describe service kubernetes-dashboard
Error from server: services "kubernetes-dashboard" not found
ubuntu@master:~$ kubectl describe services kubernetes-dashboard
Error from server: services "kubernetes-dashboard" not found
Run Code Online (Sandbox Code Playgroud)

另外,weave-net-8zdm3处于CrashLoopBackOff状态是否正常?看来我每个连接工人都有一个.如果不正常,我该如何解决?我在这里找到了类似的问题:kube-dns和weave-net没有启动但它没有给出任何实际的答案.

谢谢你的帮助!

Dan*_*rst 5

您似乎在不同的命名空间中运行您的pod default.

ubuntu@master:~$ kubectl get pods --all-namespaces返回您的pod但ubuntu@master:~$ kubectl logs etcd-master返回未找到.尝试运行kubectl logs etcd-master --all-namespaces或者如果您知道命名空间kubectl logs etcd-mastern --namespace=mynamespace.

您的服务也是如此.