gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-02 09:23:34 26 4
gpt4 key购买 nike

我可能缺少一些基本的东西。 kubectl logs 命令用法如下:

"kubectl logs [-f] [-p] POD [-c CONTAINER] [options]"

我的 Pod 列表如下:

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

我假设日志命令的 POD 是上面第二个“名称”列中的任何内容。因此,我尝试以下命令。

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

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

我对服务也有同样的问题。 如何识别要提供给命令的服务,例如“描述”命令?

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

此外,weave-net-8zdm3 处于 CrashLoopBackOff 状态正常吗? 看来我为每个连接的工作人员都有一个。 如果不正常,我该如何解决?我在这里发现了类似的问题:kube-dns and weave-net not starting但它没有给出任何实际的答案。

感谢您的帮助!

最佳答案

您似乎在与 default 不同的命名空间中运行 Pod。

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

您的服务也是如此。

关于kubernetes - kubectl 命令中的 POD 和 SERVICE 是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39864079/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com