question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 issue

Environment:

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

inspection-report-20190403_082007.tar.gz

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

15reactions
KlausTrikkcommented, Apr 26, 2019

@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!

10reactions
vinothraocommented, Apr 26, 2019

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 :

Install-Script -Name install-kubectl -Scope CurrentUser -Force install-kubectl.ps1 [-DownloadLocation <path>]

(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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

error: SchemaError(io.k8s.apimachinery.pkg.apis.meta.v1 ...
Error when running the 'apply' command on remote kubernetes: error: ... ObjectMeta): invalid object doesn't have additional properties #407.
Read more >
Kubernetes create deployment unexpected SchemaError
error : SchemaError(io.k8s.api.core.v1.NodeCondition): invalid object doesn't have additional properties. I had both Minikube and Docker ...
Read more >
invalid object doesn't have additional properties error
When I use kubectl to deploy a service: $ kubectl ... EXEC(0,0): Error : SchemaError(io.k8s.api.apps.v1beta1.
Read more >
Troubleshooting kubeadm | Kubernetes
As with any program, you might run into an error installing or running kubeadm. This page lists some common failure scenarios and have...
Read more >
Troubleshooting the GitLab agent for Kubernetes
ObjectMeta, ValidationError(Deployment.metadata): unknown field \"template\" in io.k8s.apimachinery.pkg.apis.meta.v1.ObjectMeta]" }. This error occurs when ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found