【问题标题】:kubectl does not output the logskubectl 不输出日志
【发布时间】:2021-02-09 14:37:14
【问题描述】:

我用以下方式打印我所有的 Pod:

$ kubectl get pods --all-namespaces

输出是:

NAMESPACE             NAME                                                  READY   STATUS    RESTARTS   AGE  
calico-system         calico-kube-controllers-7487d7f956-hx4fp              1/1     Running   0          88m  
calico-system         calico-node-vn52p                                     1/1     Running   0          88m  
calico-system         calico-typha-7588984c44-m6tsz                         1/1     Running   0          88m  
gitlab-managed-apps   install-ingress                                       0/1     Error     0          14m********  
gitlab-managed-apps   install-prometheus                                    0/1     Error     0          12m  
kube-system           coredns-f9fd979d6-2n2pg                               1/1     Running   0          91m  
kube-system           coredns-f9fd979d6-sq9bl                               1/1     Running   0          91m  
kube-system           etcd-tuoputuo-iamnotstone-server                      1/1     Running   0          91m  
kube-system           kube-apiserver-tuoputuo-iamnotstone-server            1/1     Running   0          91m  
kube-system           kube-controller-manager-tuoputuo-iamnotstone-server   1/1     Running   0          91m  
kube-system           kube-proxy-87jkr                                      1/1     Running   0          91m  
kube-system           kube-scheduler-tuoputuo-iamnotstone-server            1/1     Running   0          91m  
tigera-operator       tigera-operator-58f56c4958-4x9tp                      1/1     Running   0          89m  

但是当我执行日志命令时:

$ kubectl logs -f install-ingress

我看到了这个错误

Error from server (NotFound): pods "install-ingress" not found

【问题讨论】:

    标签: kubernetes kubectl


    【解决方案1】:

    install-ingress pod 位于 gitlab-managed-apps 命名空间中。如果您没有在 kubectl 命令中指定命名空间,那么它将在 default namespace 中搜索不存在 install-ingress pod 的 pod。

    你能试试下面的命令吗(指定 pod 的命名空间)。

    kubectl logs -f install-ingress -n gitlab-managed-apps
    

    【讨论】:

      猜你喜欢
      • 2019-04-25
      • 2017-01-20
      • 2012-04-21
      • 2014-04-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多