K8s version 1.21 GKE autopilot - no kind "CronJob" is registered for version "batch/v1"

1/25/2022

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 :)

-- shirab
autopilot
google-cloud-platform
google-kubernetes-engine
kubernetes
kubernetes-cronjob

1 Answer

1/26/2022

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
Source: StackOverflow