我该如何解决 minikube hello-world?
How can I resolve minikube hello-world?
我在 kubernetes 中遇到问题 运行 hello-minikube。
这是命令:
run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
这是结果:
error: v1.ReplicationController: ObjectMeta: v1.ObjectMeta: readObjectFieldAsBytes: expect : after object field, parsing 740 ...:{},"k:{\"... at {"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"hello-minikube","namespace":"default","selfLink":"/api/v1/namespaces/default/replicationcontrollers/hello-minikube","uid":"8c3308f7-eae2-4638-93be-c2c60465629a","resourceVersion":"945","generation":1,"creationTimestamp":"2020-05-06T10:08:33Z","labels":{"run":"hello-minikube"},"managedFields":[{"manager":"kubectl","operation":"Update","apiVersion":"v1","time":"2020-05-06T10:08:33Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:labels":{".":{},"f:run":{}}},"f:spec":{"f:replicas":{},"f:selector":{".":{},"f:run":{}},"f:template":{".":{},"f:metadata":{".":{},"f:creationTimestamp":{},"f:labels":{".":{},"f:run":{}}},"f:spec":{".":{},"f:containers":{".":{},"k:{\"name\":\"hello-minikube\"}":{".":{},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":8080,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:protocol":{}}},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:terminationGracePeriodSeconds":{}}}}}}]},"spec":{"replicas":1,"selector":{"run":"hello-minikube"},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"hello-minikube"}},"spec":{"containers":[{"name":"hello-minikube","image":"gcr.io/google_containers/echoserver:1.4","ports":[{"containerPort":8080,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}}},"status":{"replicas":0}}
这是我的 kubectl 版本:
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:50:46Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
我尝试卸载 kubectl,因为我发现 kubectl(客户端版本)上有一个旧版本,但我不知道如何卸载它
谁能帮帮我?
正如 Mr. J
在评论中所说
The issue is with your kubectl version,you can easily download and replace kubectl binary ...
您可以阅读 Supported releases and component skew
Different components are expected to be compatible across different amounts of skew, all relative to the master version. Nodes may lag masters components by up to two minor versions but should be at a version no newer than the master; a client should be skewed no more than one minor version from the master, but may lead the master by up to one minor version. For example, a v1.3 master should work with v1.1, v1.2, and v1.3 nodes, and should work with v1.2, v1.3, and v1.4 clients.
您应该升级客户端。您可以阅读有关 Install kubectl on Windows.
的文档
Install kubectl binary with curl on Windows
Download the latest release v1.18.0 from this link.
Or if you have curl
installed, use this command:
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe
To find out the latest stable version (for example, for scripting), take a look at https://storage.googleapis.com/kubernetes-release/release/stable.txt.
Add the binary in to your PATH.
Test to ensure the version of kubectl
is the same as downloaded:
kubectl version --client
Note: Docker Desktop for Windows adds its own version of kubectl
to PATH. If you have installed Docker Desktop before, you may need to place your PATH entry before the one added by the Docker Desktop installer or remove the Docker Desktop’s kubectl
.
我在 kubernetes 中遇到问题 运行 hello-minikube。 这是命令:
run hello-minikube --image=gcr.io/google_containers/echoserver:1.4 --port=8080
这是结果:
error: v1.ReplicationController: ObjectMeta: v1.ObjectMeta: readObjectFieldAsBytes: expect : after object field, parsing 740 ...:{},"k:{\"... at {"kind":"ReplicationController","apiVersion":"v1","metadata":{"name":"hello-minikube","namespace":"default","selfLink":"/api/v1/namespaces/default/replicationcontrollers/hello-minikube","uid":"8c3308f7-eae2-4638-93be-c2c60465629a","resourceVersion":"945","generation":1,"creationTimestamp":"2020-05-06T10:08:33Z","labels":{"run":"hello-minikube"},"managedFields":[{"manager":"kubectl","operation":"Update","apiVersion":"v1","time":"2020-05-06T10:08:33Z","fieldsType":"FieldsV1","fieldsV1":{"f:metadata":{"f:labels":{".":{},"f:run":{}}},"f:spec":{"f:replicas":{},"f:selector":{".":{},"f:run":{}},"f:template":{".":{},"f:metadata":{".":{},"f:creationTimestamp":{},"f:labels":{".":{},"f:run":{}}},"f:spec":{".":{},"f:containers":{".":{},"k:{\"name\":\"hello-minikube\"}":{".":{},"f:image":{},"f:imagePullPolicy":{},"f:name":{},"f:ports":{".":{},"k:{\"containerPort\":8080,\"protocol\":\"TCP\"}":{".":{},"f:containerPort":{},"f:protocol":{}}},"f:resources":{},"f:terminationMessagePath":{},"f:terminationMessagePolicy":{}}},"f:dnsPolicy":{},"f:restartPolicy":{},"f:schedulerName":{},"f:securityContext":{},"f:terminationGracePeriodSeconds":{}}}}}}]},"spec":{"replicas":1,"selector":{"run":"hello-minikube"},"template":{"metadata":{"creationTimestamp":null,"labels":{"run":"hello-minikube"}},"spec":{"containers":[{"name":"hello-minikube","image":"gcr.io/google_containers/echoserver:1.4","ports":[{"containerPort":8080,"protocol":"TCP"}],"resources":{},"terminationMessagePath":"/dev/termination-log","terminationMessagePolicy":"File","imagePullPolicy":"IfNotPresent"}],"restartPolicy":"Always","terminationGracePeriodSeconds":30,"dnsPolicy":"ClusterFirst","securityContext":{},"schedulerName":"default-scheduler"}}},"status":{"replicas":0}}
这是我的 kubectl 版本:
Client Version: version.Info{Major:"1", Minor:"8", GitVersion:"v1.8.0", GitCommit:"6e937839ac04a38cac63e6a7a306c5d035fe7b0a", GitTreeState:"clean", BuildDate:"2017-09-28T22:57:57Z", GoVersion:"go1.8.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"18", GitVersion:"v1.18.0", GitCommit:"9e991415386e4cf155a24b1da15becaa390438d8", GitTreeState:"clean", BuildDate:"2020-03-25T14:50:46Z", GoVersion:"go1.13.8", Compiler:"gc", Platform:"linux/amd64"}
我尝试卸载 kubectl,因为我发现 kubectl(客户端版本)上有一个旧版本,但我不知道如何卸载它
谁能帮帮我?
正如 Mr. J
在评论中所说The issue is with your kubectl version,you can easily download and replace kubectl binary ...
您可以阅读 Supported releases and component skew
Different components are expected to be compatible across different amounts of skew, all relative to the master version. Nodes may lag masters components by up to two minor versions but should be at a version no newer than the master; a client should be skewed no more than one minor version from the master, but may lead the master by up to one minor version. For example, a v1.3 master should work with v1.1, v1.2, and v1.3 nodes, and should work with v1.2, v1.3, and v1.4 clients.
您应该升级客户端。您可以阅读有关 Install kubectl on Windows.
的文档Install kubectl binary with curl on Windows
Download the latest release v1.18.0 from this link.
Or if you have
curl
installed, use this command:curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/windows/amd64/kubectl.exe
To find out the latest stable version (for example, for scripting), take a look at https://storage.googleapis.com/kubernetes-release/release/stable.txt.
Add the binary in to your PATH.
Test to ensure the version of
kubectl
is the same as downloaded:kubectl version --client
Note: Docker Desktop for Windows adds its own version of
kubectl
to PATH. If you have installed Docker Desktop before, you may need to place your PATH entry before the one added by the Docker Desktop installer or remove the Docker Desktop’skubectl
.