Question

Unable to deploy to Digital Ocean Kubernetes using GitLab CI

I’m moving my review apps from Google Kubernetes to Digital Ocean Kubernetes.

I have succesfully linked the Kubernetes clusted to GitLab. I have installed Helm Tiller, Ingress, Cert-Manager, and Prometheus using the GitLab integration. I have upgraded Tiller to the latest version manually, as did I on the previous Google cluster.

The cluster is RBAC-enabled,GitLab-managed, configured to use the default namespace, and tied to the * wildcard environment scope.

Now my deployments are failing. job output

$ helm upgrade "$CI_ENVIRONMENT_SLUG" config/charts/appsemble-docs --atomic --install --set "git.commit.sha=$CI_COMMIT_SHA" --set "image.tag=$CI_COMMIT_REF_NAME"
Error: pods is forbidden: User "system:serviceaccount:default:default-service-account" cannot list resource "pods" in API group "" in the namespace "gitlab-managed-apps"

Manual deployments on my own laptop work fine.

What could be causing this issue?


Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

John Kwiatkoski
DigitalOcean Employee
DigitalOcean Employee badge
July 2, 2019
Accepted Answer

Hi there,

This looks like an RBAC permissions issue. The error you’re seeing is saying the service-account “default-service-account” in namespace “default” doesnt have access to pods in the ‘gitlab-managed-apps’ namespace.

You can fix this by either creating a role that allows this access then binding the sa to that role witha rolebinding:

See below for examples to achieve something similar:

This will create a role pod-reader that can get, list, and watch pods

kubectl create role pod-reader --verb=get,list,watch --resource=pods -n <namespace to read pods>

Then we will create the rolebinding to associate a serviceaccount to this role that can view pods.

kubectl create rolebinding sa-read-pods --role=pod-reader --user=system:serviceaccount:default:default-service-account -n rbac

Let me know if you have any further questions.

Regards,

John Kwiatkoski Senior Developer Support Engineer

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.