4

We are having a problem with installing CronJob using Helm chart on GKE Autopilot cluster. (when we installing the same Helm chart on Standard GKE cluster with the same GKE version installation works perfectly )

GKE version- 1.21.5-gke.1302

My CronJob.yaml:

apiVersion: batch/v1
kind: CronJob
metadata:
  name: test01-chronjob

While using batch/v1beta1 version:

[WARNING] templates/test01.yaml: batch/v1beta1 CronJob is deprecated in v1.21+, unavailable in v1.25+; use batch/v1 CronJob

While using batch/v1 version:

W0125 15:08:32.558228 23300 warnings.go:70] Autopilot set default resource requests for Pod namespace01/test01, as resource requests were not specified. See http://g.co/gke/autopilot-defaults.

Error: INSTALLATION FAILED: admission webhook "workload-defaulter.common-webhooks.networking.gke.io" denied the request: no kind "CronJob" is registered for version "batch/v1" in scheme "pkg/runtime/scheme.go:100"

Would love some help :)

Gari Singh
  • 11,418
  • 2
  • 18
  • 41
shirab
  • 41
  • 2

1 Answers1

1

Sorry about this. This issue has been fixed in GKE version- 1.21.9-gke.300 which is currently available in the RAPID and REGULAR channels and will eventually be available in the STABLE channel. Clusters should start being upgraded over the next few weeks.

You can check both the default version as well as available versions for a given release channel in each region using the following commands:

default version for a channel:

gcloud container get-server-config --flatten="channels" --filter="channels.channel=${CHANNEL}" \
    --format="yaml(channels.channel,channels.defaultVersion)" --region ${REGION}

available versions for a channel:

gcloud container get-server-config --flatten="channels" --filter="channels.channel=${CHANNEL}" \
        --format="yaml(channels.channel,channels.validVersions)" --region ${REGION}

Replace ${CHANNEL} with one of RAPID,REGULAR,STABLE and ${REGION} with the region in which your cluster is deployed.

If want to upgrade prior to your cluster(s) being automatically upgraded, you can do the following assuming you are on the RAPID or REGULAR channel:

gcloud container clusters upgrade ${CLUSTER_NAME} --master --cluster-version 1.21.9-gke.300

gcloud container clusters upgrade ${CLUSTER_NAME} --cluster-version 1.21.9-gke.300
Gari Singh
  • 11,418
  • 2
  • 18
  • 41
  • 1
    Hi! Thanks for the answer:) Do you know if the gke version in the autopilot will be also updated in the next few days? – shirab Jan 27 '22 at 13:24
  • It should be rolling out across various regions over the next few days. – Gari Singh Jan 27 '22 at 13:29
  • @GariSingh I am also suffering from the same problem. I am using the autopilot GKE as well. Is GKE updated automatically or am I supposed to do something myself to realize the update? – edn Feb 07 '22 at 21:25
  • @GariSingh Thank you for the additional information. But does this mean that my cluster will automatically be updated soon even if I do not do anything? If I want to make the update manually, what are the steps that I need to do? – edn Feb 08 '22 at 12:44
  • @GariSingh sorry to intrude upon this thread, but it's the only place I've found this issue. I'm having a similar issue, when I try to create a cronjob with `batch/v1` I'm getting this error: `admission webhook "workload-defaulter.common-webhooks.networking.gke.io" denied the request: no kind "CronJob" is registered for version "batch/v1" in scheme "pkg/runtime/scheme.go:100"` I'm on an autopilot cluster. Both the cluster itself and all nodes are `v1.21.6-gke.1500`. – avlund Feb 11 '22 at 15:05
  • 1
    Hmm ... let me check. That version is supposed to have fixed the issue. :-( – Gari Singh Feb 11 '22 at 15:22
  • 1
    @avlund My apologies. The `batch/v1` API for CronJob requires GKE version `1.21.9-gke.300` or later. Updated my answer above as well. – Gari Singh Feb 14 '22 at 11:56
  • @GariSingh Thanks very much! I have upgraded my cluster, but I cannot manually update my nodes and it didn't happen in this night's maintenance window. Guess I'll just have to wait. Thanks for the quick reply though. – avlund Feb 15 '22 at 10:55
  • @avlund - it should still work as long as the control plane / master version is `1.21.9-gke.300`. – Gari Singh Feb 15 '22 at 13:05
  • @GariSingh: Thanks for that, it seems to have worked. The `apiVersion` of the yaml still says `batch/v1beta1` (despite being created as `batch/v1`), but I can create the cronjob and replace the image now. Again thanks for helping out! – avlund Feb 16 '22 at 10:12