Kubernetes는 예기치 않은 배포 SchemaError를 만듭니다.
이 튜토리얼 ( https://www.baeldung.com/spring-boot-minikube )을 따르고 있습니다. yaml 파일 (simple-crud-dpl.yaml)에 Kubernetes 배포를 만들고 싶습니다.
apiVersion: apps/v1
kind: Deployment
metadata:
name: simple-crud
spec:
selector:
matchLabels:
app: simple-crud
replicas: 3
template:
metadata:
labels:
app: simple-crud
spec:
containers:
- name: simple-crud
image: simple-crud:latest
imagePullPolicy: Never
ports:
- containerPort: 8080
하지만 내가 달릴 때 나는 kubectl create -f simple-crud-dpl.yaml
얻었습니다.error: SchemaError(io.k8s.api.autoscaling.v2beta2.MetricTarget): invalid object doesn't have additional properties
최신 버전의 kubectl을 사용하고 있습니다.
kubectl version
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:"darwin/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"}
튜토리얼에서 설명한대로 minikube를 로컬로 사용하고 있습니다. 배포 및 서비스까지 모든 것이 작동합니다. 나는 그것을 할 수 없다.
brew와 함께 kubectl을 설치 한 후 다음을 실행해야합니다.
rm /usr/local/bin/kubectl
brew link --overwrite kubernetes-cli
또한 선택적으로 :
brew link --overwrite --dry-run kubernetes-cli
.
나는 두 번째 @rennekon의 대답입니다. 나는 또한 설치하는 내 컴퓨터에서도 커가 실행되고 있음을 발견했습니다 kubectl
. kubectl을 설치하면이 문제가 표시됩니다.
다음 단계를 수행했습니다.
- 그것을 사용하여 제거
brew uninstall kubectl
- 사용하여 다시 설치
brew install kubectl
- (심볼 링크 생성 실패로 인해) brew가
brew link --overwrite kubernetes-cli
그런 다음 kubectl apply
명령을 성공적으로 실행할 수있었습니다 .
나도 같은 문제가 있었다. 내 시스템에서 kubectl 은 Docker를 설치할 때 사전 설치된 docker에서 실행됩니다. 아래 명령을 사용하여 확인할 수 있습니다.
ls -l $(which kubectl)
반환되는
/ usr / local / bin / kubectl-> /Applications/Docker.app/Contents/Resources/bin/kubectlcode.
이제 brew를 사용하여 설치된 kubectl로 심볼릭 링크를 덮어 써야합니다.
rm /usr/local/bin/kubectl
brew link --overwrite kubernetes-cli
(옵션)
brew unlink kubernetes-cli && brew link kubernetes-cli
확인하려면
ls -l $(which kubectl)
Docker를 설치 한 후 minikube / Windows 10에서 동일한 문제가 발생했습니다. 이 스레드에서 이미 몇 번 언급 된 kubectl의 버전 불일치로 인해 발생했습니다. Docker는 kubectl 버전 1.10을 설치합니다.
몇 가지 옵션이 있습니다.
1) Make sure the path to your k8s bin is above the ones in docker
2) Replace the kubectl in 'c:\Program Files\Docker\Docker\resources\bin' with the correct one
Your client version is too old. In my env this version comes with Docker. I have to download new client from https://storage.googleapis.com/kubernetes-release/release/v1.14.0/bin/windows/amd64/kubectl.exe and now works fine:
kubectl version
Client Version: version.Info{Major:"1", Minor:"14", GitVersion:"v1.14.0", GitCommit:"641856db18352033a0d96dbc99153fa3b27298e5", GitTreeState:"clean", BuildDate:"2019-03-25T15:53:57Z", GoVersion:"go1.12.1", 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"}
You are using the wrong kubectl version.
Kubectl is compatible 1 version up and down as described in the official docs
The error is confusing but it simply means that your version 1.10 isn't sending all the required parameters to the 1.14 api.
I am on Windows 10 with Docker Client and Minikube both installed. I was getting the error below;
error: SchemaError(io.k8s.api.core.v1.Node): invalid object doesn't have additional properties
I resolved it by updating the version of kubectl.exe to that being used by minikube. Here are the steps:
Note: Minikube tends to use the latest version of Kubernetes so it will be advisable to grab the latest kubectl.
Navigate to your Docker path where your kubectl is located e.g.
C:\Program Files\Docker\Docker\resources\bin
Place your downloaded kubectl.exe there. If it asks you replace it, please do.
Now type
refreshenv
in Powershell.Check the new version if it's what you have placed there;
kubectl version
.
Now you are good, retry whatever tasks you was doing.
Was running into the same issue after installing kubectl on my Mac today. Uninstalling kubectl [via brew uninstall kubectl
] and reinstalling [brew install kubectl
] resolved the issue for me.
For me Docker installation was the problem. As Docker now comes with Kubernetes support, it installs kubectl along with its own installation. I had downloaded kubectl and minikube without knowing it, then my minikube was being used by Docker's kubectl installation.
Make sure that it is not also happening with you.
A second cause would be a deprecated apiVersion in your .yaml files.
I had a similar problem with error
error: SchemaError(io.k8s.api.storage.v1beta1.CSIDriverList): invalid object doesn't have additional properties
My issue was that my mac was using google's kubectl that was installed with the gcp tools. My path looks there first before going into /usr/local/bin/
Once I run kubectl from /usr/local/bin my problem went away.
In my case, kubectl is always using google's kubectl by gcloud tool, or there was most probably a conflict between Homebrew installed and Gcloud Installed kubectl. I uninstalled Homebrew kubectl and upgrade gcloud tool to the latest, which eventually upgrades the kubectl also in the process. It resolved my issue.
You can use "--validate=false" in your command. For example:
kubectl create -f simple-crud-dpl.yaml --validate=false
I don't think the problem is with imagePullPolicy
, unless you don't have the image locally. The error is about autoscaling
, which means it's not able to create replicas of the container.
Can you set replicas: 1
and give it a try?
According to the kubectl docs,
You must use a kubectl version that is within one minor version difference of your cluster.
kubectl v1.10 client apparently makes requests to kubectl v1.14 server without some newly (in 4 minor versions) required parameters.
For brew
users, reinstall kubernetes-cli
. It's worth checking what installed the incompatible version. For brew
users, check the command symlink ls -l $(which kubectl)
.
On windows 10.0, uninstalling Docker helped me get away this problem. Doing with kubectl and minikube.
I was getting below error while running kubectl explain pod
on windows 10
error: SchemaError(io.k8s.api.core.v1.NodeCondition): invalid object doesn't have additional properties
I had both Minikube and Docker Desktop installed. Reason for this error, as mentioned in earlier answers as well, was mismatch between server (major 1 minor 15) and client version (major 1 minor 10). Client version was coming from Docker Desktop. To fix I upgraded kubectl client version to v1.15.1 as described here
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.15.1/bin/windows/amd64/kubectl.exe
Mac user !!! This is for those who installed docker desktop first. The error will show up when you use the apply command. The error comes for a version miss match as some people said here. I did not install kubectl using homebrew. Rather kubectl auto get install when you install docker desktop for mac.
To fix this what I have done is bellow: Remove the kubectl executable file
rm /usr/local/bin/kubectl
Download kubectl: curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/darwin/amd64/kubectl
Change the permission:
chmod +x ./kubectl
Move the executable file :
sudo mv ./kubectl /usr/local/bin/kubectl
That is it folks! Just to show it worked here is the output:
kubectl apply -f ./deployment.yaml
deployment.apps/tomcat-deployment created
Make sure the yml file is correct. I downloaded a valid file from here to test : https://github.com/LevelUpEducation/kubernetes-demo/tree/master/Introduction%20to%20Kubernetes/Your%20First%20k8s%20App
ReferenceURL : https://stackoverflow.com/questions/55417410/kubernetes-create-deployment-unexpected-schemaerror
'Programing' 카테고리의 다른 글
iOS 앱 아이콘에서 배지 제거 (0) | 2021.01.09 |
---|---|
UISearchBar / 키보드 검색 버튼 제목 변경 (0) | 2021.01.09 |
UIImage가있는 Swift 플레이 그라운드 (0) | 2021.01.09 |
루비에서 배열을 같은 부분으로 나누기 (0) | 2021.01.09 |
Javascript의 배열에서 가장 작은 값을 얻습니까? (0) | 2021.01.09 |