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

时间:2018-06-11 20:14:10

标签: kubernetes kubectl minikube

我正在关注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)

为什么我收到该错误?通过docs和github彻底搜索但找不到答案。

1 个答案:

答案 0 :(得分:2)

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

这是Kubernetes源代码段,用于设置这些旧版默认值。 enter image description here

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

dplyr::case_when