Error when running the ‘apply’ command on remote kubernetes: error: SchemaError(io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta): invalid object doesn't have additional properties
See original GitHub issueEnvironment:
I have two machines. The first one with clean ubuntu (I have only docker and harbor installed on it). The second - with windows 10 running docker for windows with enabled kubernetes.
I want to connect kubernetes from my windows machine to kubernetes on ubuntu.
I ran a next command to install microk8s on ubuntu:
$ sudo snap install microk8s --classic
After that, I got configuration using the command
$ microk8s.config
My configuration:
apiVersion: v1
clusters:
- cluster:
certificate-authority-data: ***
server: https://192.168.10.54:16443
name: microk8s-cluster
contexts:
- context:
cluster: microk8s-cluster
user: admin
name: microk8s
current-context: microk8s
kind: Config
preferences: {}
users:
- name: admin
user:
username: admin
password: ***
I replaced the whole kubernetes configuration file on windows machine with the above configuration text.
Kubernetes version (use ‘kubectl version’ on windows machine) :
Client Version: version.Info{Major:"1", Minor:"10", GitVersion:"v1.10.11", GitCommit:"637c7e288581ee40ab4ca210618a89a555b6e7e9", GitTreeState:"clean", BuildDate:"2018-11-26T14:38:32Z", GoVersion:"go1.9.3", Compiler:"gc", Platform:"windows/amd64"}
Server Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:45:25Z", GoVersion:"go1.12.1", Compiler:"gc", Platform:"linux/amd64"}
What happened:
On windows machine, I can successfully run ‘get pods’ command that shows running pods on ubuntu. I even can run ‘delete’ command on windows machine to remove deployment on ubuntu. But when I try to run ‘apply’ command, I got the error
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
error: SchemaError(io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta): invalid object doesn't have additional properties
When I run this command directly on ubuntu, it succeeded.
What you expected to happen:
After executing the command
kubectl apply -f https://k8s.io/examples/application/deployment.yaml
I expected that I would have running pod on my ubuntu
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (4 by maintainers)
Top GitHub Comments
@vinothrao, thank you, this solved my problem!
I’ve downloaded the newest kubectl.exe using the link above and replaced the old one (C:\Program Files\Docker\Docker\resources\bin\kubectl.exe) with it and it works for me!
Thanks a lot!
This has happened to me because of wrong version of kubectl installed by docker in the path “C:\Program Files\Docker\Docker\resources\bin” .
I resolved this by following below steps
Install kubectl manually by :
(https://kubernetes.io/docs/tasks/tools/install-kubectl/#install-kubectl-on-windows)
CD to the [-DownloadLocation <path>] folder and run kubectl from here . If the location is not given it will install it in temp by default. I have installed it in temp PS C:\Users\sysadmin\AppData\Local\Temp> : .\kubectl.exe version
If the version mismatch run the command again and check. Try kubectl apply from this location.
PS C:\Users\sysadmin\AppData\Local\Temp> .\kubectl.exe apply -f C:\Users\sysadmin\source\repos\RecruitManage\webapp-pod.yaml
Note : careful about that kubectl use .\kubectl.exe which is inside the folder not the plain kubectl because it will fall back to Docker’s kubectl as it is set in environment variable.