CI/CD with Kubernetes 1.16: Production job fails, possibly due to Kubernetes version?


we’re using Gitlab CI/CD on with a connected Kubernetes cluster. Until recently, we ran on Azure, but have now decided to switch over to digitalocean. When I run our build / deploy pipeline now on our fresh cluster, I’m getting this error in the “production” job:

$ auto-deploy deploy
secret/production-secret replaced
Deploying new release...
Release "production" does not exist. Installing it now.
Error: validation failed: unable to recognize "": no matches for kind "Deployment" in version "extensions/v1beta1"
ERROR: Job failed: exit code 1

After doing some googling, I found this release announcement for Kubernetes 1.16, which states that the Deployment resource has been moved up from extensions/v1beta1 to (eventually) apps/v1:

The Kubernetes version used on digitalocean is indeed 1.16.2. I do not recall the version we used on Azure, but judging from the article’s date, the 1.16 release is somewhat recent (September 2019).

My question is this: Am I right in assuming that this issue is caused by Gitlab’s CI/CD using a pre-1.16 notation to automatically create Deployments on Kubernetes clusters? If so, how can I adapt the deployment script to use the apps/v1 scope?

Update for anyone who is interested:

To test whether the problem was really caused by the different Kubernetes versions used, I created a new cluster on digitalocean using the previous Kubernetes version (1.15) and connected that cluster to Gitlab CI/CD. The build / deploy pipeline works fine, so I guess the hypothesis was correct.

Now, this is certainly not a perfect solution - I’d like to be able to use current software on my servers, but for now it’s ok.

After some digging, it seems that Gitlab’s own auto-deploy-image uses Kubernetes 1.13.12. This is defined at the top of its .gitlab-ci.yml. What I don’t know is if one could just change the version up there, rebuild the auto-deploy-image and use it instead of Gitlab’s version, or if there are further version incompatibility issues that would pop up if one did that.

1 Like