Kubernetes“服务器没有资源类型部署". [英] Kubernetes "the server doesn't have a resource type deployments"

查看:1285
本文介绍了Kubernetes“服务器没有资源类型部署".的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是kubernetes的新手.

I'm new on kubernetes.

我无法使用kubectl进行部署,但是我可以在kubernetes仪表板上看到所有部署.我该如何解决这个问题?

I couldn't get deployments using kubectl but I can see all deployments on kubernetes dashboard. How can i fix this problem?

user@master:~$ kubectl get deployments
error: the server doesn't have a resource type "deployments"

kubernetes版本: 1.12

kubectl版本: 1.13

kubectl api版本:

apiregistration.k8s.io/v1

apiregistration.k8s.io/v1

apiregistration.k8s.io/v1beta1

apiregistration.k8s.io/v1beta1

v1

api资源:

user@master:~$ kubectl api-resources
NAME                     SHORTNAMES   APIGROUP                 NAMESPACED               
KIND
bindings                                                       true         
Binding
componentstatuses        cs                                    false        
ComponentStatus
configmaps               cm                                    true         
ConfigMap
endpoints                ep                                    true         
Endpoints
events                   ev                                    true         
Event
limitranges              limits                                true         
LimitRange
namespaces               ns                                    false        
Namespace
nodes                    no                                    false        
Node
persistentvolumeclaims   pvc                                   true         
PersistentVolumeClaim
persistentvolumes        pv                                    false        
PersistentVolume
pods                     po                                    true         
Pod
podtemplates                                                   true         
PodTemplate
replicationcontrollers   rc                                    true         
ReplicationController
resourcequotas           quota                                 true         
ResourceQuota
secrets                                                        true         
Secret
serviceaccounts          sa                                    true         
ServiceAccount
services                 svc                                   true         
Service
apiservices                           apiregistration.k8s.io   false        
APIService

感谢您的帮助.

-----------编辑1 -----------

您好,@ EduardoBaitello,谢谢您的答复.问题与许可无关.

Hello @EduardoBaitello, Thank you for quicly reply. The problem is not related to permission.

user@master:~$ kubectl auth can-i get deployments Warning: the server doesn't have a resource type 'deployments' yes user@master:~$ kubectl auth can-i get deployment Warning: the server doesn't have a resource type 'deployment' yes user@master:~$ kubectl auth can-i get namespaces yes user@master:~$ kubectl auth can-i get pods yes

user@master:~$ kubectl auth can-i get deployments Warning: the server doesn't have a resource type 'deployments' yes user@master:~$ kubectl auth can-i get deployment Warning: the server doesn't have a resource type 'deployment' yes user@master:~$ kubectl auth can-i get namespaces yes user@master:~$ kubectl auth can-i get pods yes

所以我认为这不是重复的问题.

So I think this is not a duplicated question.

user@master:~$ kubectl get po --namespace=kube-system NAME READY STATUS RESTARTS AGE calico-kube-controllers-7c6b876df8-nk7nm 1/1 Running 2 118d calico-node-8lt9f 1/1 Running 3 118d calico-node-d9r9l 1/1 Running 2 118d calico-node-ffqlj 1/1 Running 2 118d dns-autoscaler-57ff59dd4c-c9tjv 1/1 Running 2 118d kube-apiserver-node1 1/1 Running 3 118d kube-controller-manager-node1 1/1 Running 6 118d kube-dns-84467597f5-hf2fn 3/3 Running 6 118d kube-dns-84467597f5-sttgx 3/3 Running 9 118d kube-proxy-node1 1/1 Running 3 118d kube-proxy-node2 1/1 Running 2 118d kube-proxy-node3 1/1 Running 2 118d kube-scheduler-node1 1/1 Running 6 118d kubernetes-dashboard-5db4d9f45f-gkl6w 1/1 Running 3 118d nginx-proxy-node2 1/1 Running 2 118d nginx-proxy-node3 1/1 Running 2 118d tiller-deploy-6f6fd74b68-27fqc 1/1 Running 0 16d

user@master:~$ kubectl get po --namespace=kube-system NAME READY STATUS RESTARTS AGE calico-kube-controllers-7c6b876df8-nk7nm 1/1 Running 2 118d calico-node-8lt9f 1/1 Running 3 118d calico-node-d9r9l 1/1 Running 2 118d calico-node-ffqlj 1/1 Running 2 118d dns-autoscaler-57ff59dd4c-c9tjv 1/1 Running 2 118d kube-apiserver-node1 1/1 Running 3 118d kube-controller-manager-node1 1/1 Running 6 118d kube-dns-84467597f5-hf2fn 3/3 Running 6 118d kube-dns-84467597f5-sttgx 3/3 Running 9 118d kube-proxy-node1 1/1 Running 3 118d kube-proxy-node2 1/1 Running 2 118d kube-proxy-node3 1/1 Running 2 118d kube-scheduler-node1 1/1 Running 6 118d kubernetes-dashboard-5db4d9f45f-gkl6w 1/1 Running 3 118d nginx-proxy-node2 1/1 Running 2 118d nginx-proxy-node3 1/1 Running 2 118d tiller-deploy-6f6fd74b68-27fqc 1/1 Running 0 16d

user@master:~$ kubectl get componentstatus NAME STATUS MESSAGE scheduler Healthy ok controller-manager Healthy ok etcd-2 Healthy {"health": "true"} etcd-1 Healthy {"health": "true"} etcd-0 Healthy {"health": "true"}

user@master:~$ kubectl get componentstatus NAME STATUS MESSAGE scheduler Healthy ok controller-manager Healthy ok etcd-2 Healthy {"health": "true"} etcd-1 Healthy {"health": "true"} etcd-0 Healthy {"health": "true"}

推荐答案

请将用户更改为root并尝试相同的操作.它对我有用

please change user to root and try the same. It worked for me

这篇关于Kubernetes“服务器没有资源类型部署".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆