Error: This job failed because the necessary resources were not successfully created

,

Hi,

I am trying to deploy my node.js service to Kubernetes (Aws EKS) on self hosted gitlab. The service has Dockerfile, and I am able to use the service using docker-compose locally. I haven’t created .gitlab-ci.yml.

I was trying to deploy to production from master branch. But nothing was working. So I deleted the namespace for production on kubernetes using kubectl command manually. I deleted the production environment also in gitlab. But now when I run the pipeline, production job is not running at all, and I am getting this error:

This job failed because the necessary resources were not successfully created.

I can see the namespace is created in the kubernetes. I am very new to all this. Can somebody help me out how to fix this?

Thanks.

Hi @slashblog

The .gitlab-ci.yml file defines the pipeline for your project. This is where you will need to put all the commands to build/test/deploy your code.

That said, your error message suggests that maybe something else is going on. You might want to look at the troubleshooting guide or your kubernetes.log file for clues.

Thanks for your response. I resolved this issue by “Remove Kubernetes cluster integration” and then again adding the existing kubernetes cluster. Not the ideal solution, I suppose, but with that I was able to deploy on production.

Just, if you could help me in pointing to any existing .gitlab-ci.yml file for node.js that I can edit for my specific needs. Specifically, I need to deploy to production, staging, and review apps.

I could only find the following: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Nodejs.gitlab-ci.yml

Hi @slashblog

Glad you got it working!

I’m not sure about your .gitlab-ci.yml file. This blog post looks relevant, and this project has a similar config. However, it’s probably a good idea to read some general docs also.

Thanks for the links and the quick reply. Will go through them.