【发布时间】:2020-07-21 19:02:30
【问题描述】:
我开始学习 Kubernetes。我按照教程进行操作,但无法重现该步骤。我只是安装了 kubectl 和 minikube,以 docker 作为驱动程序启动 minikube 并运行一个 pod。
filip@filip-pc:~/Desktop$ kubectl get pods
NAME READY STATUS RESTARTS AGE
my-apache 1/1 Running 0 5h7m
my-nging 1/1 Running 0 4h59m
filip@filip-pc:~/Desktop$ kubectl scale --replicas=2 my-apache
error: the server doesn't have a resource type "my-apache"
filip@filip-pc:~/Desktop$ kubectl cluster-info
Kubernetes master is running at https://172.17.0.3:8443
KubeDNS is running at https://172.17.0.3:8443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
我可以管理一个 pod,但我无法管理它。 如果我点击链接https://172.17.0.3:8443 我会收到一个错误
{
"kind": "Status",
"apiVersion": "v1",
"metadata": {
},
"status": "Failure",
"message": "forbidden: User \"system:anonymous\" cannot get path \"/\"",
"reason": "Forbidden",
"details": {
},
"code": 403
}
我对此错误进行了简短的研究,但我发现的解决方案对我不起作用。 正如我提到的,我是 kubernetes 的新手,但我知道这是一个特权问题,但我使用的用户有权限
filip@filip-pc:~/Desktop$ kubectl auth can-i create deployments --namespace dev
yes
filip@filip-pc:~/Desktop$ kubectl auth can-i create deployments --namespace prod
yes
【问题讨论】:
-
你是如何得到你的豆荚的?请分享这些步骤。很可能你只制作了 pod,阅读了 k8s 中的部署,然后尝试扩展它。kubernetes.io/docs/concepts/workloads/controllers/deployment
-
@tarunkhosla kubectl run --name my-apache --image httpd
标签: kubernetes google-kubernetes-engine kubernetes-pod