Help us understand the problem. What is going on with this article?

kubectl apply で SchemaError(io.k8s.api.apps.v1.DeploymentList) と出たときの対処法

この記事はMacで開発していることを前提に書いてます

現象

  • GKEのバージョンを1.14.xにアップグレードした後にkubectl applyを実行したら、以下のようなエラーが出ました
$ kubectl apply -f deployment.yaml 
error: SchemaError(io.k8s.api.apps.v1.DeploymentList): invalid object doesn't have additional properties

原因

  • kubectlのClientバージョンが古い場合に起こるようです
  • kubectl versionで見てみます
$ kubectl version
Client Version: version.Info{Major:"1", Minor:"10", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", Platform:"linux/amd64"}

対処法

kubectlのバージョンを上げます

  • usr/local/bin下のkubectlを削除します
  • 最新のkubectlをダウンロードして、usr/local/bin下に置きます
$ rm /usr/local/bin/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
$ chmod +x ./kubectl
$ sudo mv ./kubectl /usr/local/bin/kubectl

$ kubectl version
Client Version: version.Info{Major:"1", Minor:"16", Platform:"darwin/amd64"}
Server Version: version.Info{Major:"1", Minor:"14+", Platform:"linux/amd64"}

kubectlのバージョンを上げないで一時的に済ます場合は--validate=falseをつけます

$ kubectl apply -f deployment.yaml --validate=false
deployment.extensions "hoge" configured

参考URL

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした