kubernetes: Cannot update cronjob from within pod (NotAcceptable 406 error)

Is this a BUG REPORT or FEATURE REQUEST?:

/kind bug

What happened:

When calling kubectl apply -f cronjob.yml from within a pod (even with the admin service account attached to it), I get back a 406 NotAcceptable:

0328 01:54:42.361974     431 merged_client_builder.go:123] Using in-cluster configuration
I0328 01:54:42.382441     431 helpers.go:201] server response object: [{
  "metadata": {},
  "status": "Failure",
  "message": "unknown",
  "reason": "NotAcceptable",
  "details": {
    "causes": [
      {
        "reason": "UnexpectedServerResponse",
        "message": "unknown"
      }
    ]
  },
  "code": 406
}]
F0328 01:54:42.382471     431 helpers.go:119] Error from server (NotAcceptable): unknown

What you expected to happen:

I would expect the cronjob to be created/updated. Running kubectl apply manually, on my local machine, with the same manifest and the same role, works.

How to reproduce it (as minimally and precisely as possible):

Create a pod + a service account that allows cronjob create/update/delete and try to use kubectl apply within the pod.

Anything else we need to know?:

Other resources like deployments or services are successfully applied.

Environment:

  • Kubernetes version (use kubectl version): Client Version: version.Info{Major:“1”, Minor:“10”, GitVersion:“v1.10.0”, GitCommit:“fc32d2f3698e36b93322a3465f63a14e9f0eaead”, GitTreeState:“clean”, BuildDate:“2018-03-26T16:55:54Z”, GoVersion:“go1.9.3”, Compiler:“gc”, Platform:“linux/amd64”} Server Version: version.Info{Major:“1”, Minor:“8”, GitVersion:“v1.8.5”, GitCommit:“cce11c6a185279d037023e02ac5249e14daa22bf”, GitTreeState:“clean”, BuildDate:“2017-12-07T16:05:18Z”, GoVersion:“go1.8.3”, Compiler:“gc”, Platform:“linux/amd64”}
  • Cloud provider or hardware configuration: AWS
  • OS (e.g. from /etc/os-release): Ubuntu 16.04.3 LTS
  • Kernel (e.g. uname -a): Linux dss-554577754d-kc6sf 4.14.19-coreos #1 SMP Wed Feb 14 03:18:05 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 15 (10 by maintainers)

Commits related to this issue

Most upvoted comments

This happens because the new version kubectl requires a Content-Type of application/com.github.proto-openapi.spec.v2@v1.0+protobuf. But the old version of kube-apiserver doesn’t support this Content-Type.

@alexef The kubectl version is v1.10.0, but the kube-apiserver version is go1.8.5