gpt4 book ai didi

kubernetes - Kubernetes-Minikube kubectl错误:您必须登录到服务器

转载 作者:行者123 更新时间:2023-12-02 11:58:25 26 4
gpt4 key购买 nike

我正在遵循有关Linux Mint 18.3的简单Kuberentes Minikube教程,尝试通过以下入门教程创建卷:

https://kubernetes.io/docs/tasks/run-application/run-single-instance-stateful-application/

minikube start --vm-driver=virtualbox
Starting local Kubernetes v1.10.0 cluster...
Starting VM...
Getting VM IP address...
Moving files into cluster...
Setting up certs...
Connecting to cluster...
Setting up kubeconfig...
Starting cluster components...
Kubectl is now configured to use the cluster.
Loading cached images from config file.

kubectl config use-context minikube
Switched to context "minikube"

kubectl create -f https://k8s.io/docs/tasks/run-application/mysql-pv.yaml
error: You must be logged in to the server (the server has asked for the client to provide credentials)

为什么会收到该错误?彻底搜索了文档和github,但找不到答案。

最佳答案

我可以在带有Kuberebtes版本1.8的minikube v0.23.0中成功尝试上述示例。但是,我猜v1.10失败的原因是未正确设置对Kubelet API的默认身份验证和授权。您应该将旧式默认值设置为KubeletConfiguration,以保留命令行API。

这是设置这些旧式默认设置的Kubernetes源代码片段。
https://github.com/kubernetes/kubernetes/blob/de8cc313554b7f7d41509ca620f71439cd8729eb/cmd/kubelet/app/options/options.go#L281-L293

运行以下命令应设置这些值:

minikube start --extra-config=kubelet.Authentication.Anonymous.Enabled=true 
--extra-config=kubelet.Authentication.Webhook.Enabled=false
--extra-config=kubelet.Authorization.Mode=AlwaysAllow

关于kubernetes - Kubernetes-Minikube kubectl错误:您必须登录到服务器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50805359/

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