Kubernetes Environment Scopes

Hey there. :smile:

I was trying to use Kubernetes Environment Scopes under a free private repository inside gitlab.com.

Looking at https://docs.gitlab.com/ee/user/project/clusters/index.html#multiple-kubernetes-clusters I saw the following:

"You can associate more than one Kubernetes cluster to your project. That way you can have different clusters for different environments, like dev, staging, production, and so on.

Simply add another cluster, like you did the first time, and make sure to set an environment scope that will differentiate the new cluster with the rest."

However, I saw right bellow that I can use different kubernetes clusters but environment scopes is available only at Premium.

My use case is: I have an AWS account for staging and other one for production and different clusters for each cluster type.

For having different clusters for different environments I normally would use environment scopes for it as the documentation mentions.

Would not make sense to move environment scopes to core as well so the description fits the proposed use case?

Thanks for your time reviewing this :handshake:

Hi there Ayr-ton,

It seems the documentation was not updated properly. It looks like the environment scopes should also be made available to a free account on gitlab.com.

In this case, all you would need to do is:

  1. Configure multiple clusters via the Operations->Kubernetes menu.

  2. Make sure that each cluster has a different value under Environment Scope, in the example in the docs we have a wildcard and the name production.

  3. Configure your .gitlab-ci.yml file as directed in the documentation:

    stages:

    • test
    • deploy

    test:
    stage: test
    script: sh test

    deploy to staging:
    stage: deploy
    script: make deploy
    environment:
    name: staging
    url: https://staging.example.com/

    deploy to production:
    stage: deploy
    script: make deploy
    environment:
    name: production
    url: https://example.com/

Let us know if this is not working and if you could, please share a snippet of the job configuration and a screen capture of the cluster config.

1 Like

BTW Here is the MR to remove the Premium Tag from the documentation.
Thank you for bringing this to our attention!

1 Like