Error from server (NotFound): deployments.extensions not found

Hello,

I started using GitLab Auto DevOps with custom Helm charts. Maybe the answer is obvious but I got an error at the end of the deployment stage that I cannot explain at this point in time :
Error from server (NotFound): deployments.extensions “production” not found

Bellow are my chart and a screenshot of the logs.

By the way, regarding that I configured a base domain for the Kubernetes cluster, shouldn’t I get an url related to it after the application is deployed ? At this time I only get the IP of the LoadBalancer as shown on the screenshot.


Thanks for your help.

I am also having the same issue. I did notice however, that even though GitLab CI gets an error and the pipeline fails, the deployment is actually successfully on the cluster.

I am not able to figure out what is going wrong.

Hello Michael,

Yes the deployment is actually successful on the cluster, nevertheless I fixed the pipeline issue in the meantime.

In fact, GitLab needs that the deployment name is equal to the current environment name. For example, when working on the master branch the environment name GitLab uses is “production”, so the deployment name must be “production”. If you work on another branch, the environment name will be different.

The solution is to set the name of the deployment equal to the current environment name. In my repository (see above) I only had to update the values.yaml file with:
fullnameOverride: “production”

The next step is indeed to change the name of the deployment depending on the environment name. One way to do it is by using environment variables. First create another file containing the staging values: values.staging.yaml. Then, in the navigation pane, select Settings > CI/CD . Expand the Variables section and add a new variable called HELM_UPGRADE_EXTRA_ARGS. Set this variable to the name of the file containing the staging values, in my example: values.staging.yaml

Make sure that this environment variable is associated to a specific stage by updating the scope like shown in this picture.

Hope this helps.

2 Likes

Thank you for the response. As per your direction, I’ve been able to resolve this issue. Many thanks :slight_smile:

1 Like

Thank you very much for such an easy solution! I had simillar issue, but the message was a little bit different:

deployments.apps "production" not found

GitLab version: 12.10.5
Kubernetes version: 1.18.1

2 Likes