Group-wide Kubernetes Cluster, missing variables in CI

Summary

When using group-wide Kubernetes Cluster the deployment stage is missing some kubernetes configuration variables.

Steps to reproduce

Create a group-wide kubernetes cluster and create a project with the following .gitlab-ci.yml:

stages:
  - deploy

deploy:
  stage: deploy
  image: lachlanevenson/k8s-kubectl:latest
  script:
    - echo $KUBE_NAMESPACE
    - echo $KUBE_URL
    - echo $KUBECONFIG
    - cat $KUBECONFIG
    - echo $KUBE_TOKEN
  environment:
    name: production
    url: https://test.test.tld
  only:
    - master

What is the current bug behavior?

Variables like KUBE_NAMESPACE and KUBE_TOKEN are missing/empty

What is the expected correct behavior?

All variables should be filled correctly and kubectl should be able to make a connection to the cluster

Relevant logs and/or screenshots

$ echo $KUBE_NAMESPACE

$ echo $KUBE_URL
https://kubernetes.coco.local:6443
$ echo $KUBECONFIG

$ cat $KUBECONFIG
$ echo $KUBE_TOKEN

Output of checks

  • Namespaces was created by GitLab
  • ServiceAccount was created in the relevant namespace

Results of GitLab environment info

Expand for output related to GitLab environment info
System information
System:         Ubuntu 16.04
Current User:   git
Using RVM:      no
Ruby Version:   2.5.3p105
Gem Version:    2.7.6
Bundler Version:1.16.6
Rake Version:   12.3.1
Redis Version:  3.2.12
Git Version:    2.18.1
Sidekiq Version:5.2.3
Go Version:     unknown

GitLab information Version: 11.6.0-rc7 Revision: 7d28248 Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://git.coco.local HTTP Clone URL: http://git.coco.local/some-group/some-project.git SSH Clone URL: git@git.coco.local:some-group/some-project.git Using LDAP: no Using Omniauth: yes Omniauth Providers: saml

GitLab Shell Version: 8.4.3 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check
Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 8.4.3 ? ... OK (8.4.3) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Check GitLab API access: OK Redis available via internal API: OK

Access to /var/opt/gitlab/.ssh/authorized_keys: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 2/1 ... yes 2/2 ... yes 3/3 ... yes 3/4 ... yes 2/5 ... yes 4/6 ... yes 7/7 ... yes 4/8 ... yes 7/9 ... yes 7/10 ... yes 7/12 ... yes 7/13 ... yes 7/14 ... yes 7/15 ... yes 7/16 ... yes 7/17 ... yes 7/18 ... yes 7/19 ... yes 7/20 ... yes 9/21 ... yes 7/22 ... yes 7/24 ... yes 7/25 ... yes 7/26 ... yes 2/27 ... yes 7/28 ... yes 7/29 ... yes 11/30 ... yes 12/31 ... yes 12/32 ... yes 12/33 ... yes 13/34 ... yes 7/35 ... yes 14/36 ... yes 7/37 ... yes 1/38 ... yes 7/39 ... yes 1/40 ... yes 17/41 ... yes 17/42 ... yes 12/44 ... yes 7/45 ... yes 1/46 ... yes 7/47 ... yes 7/48 ... yes 7/49 ... yes Redis version >= 2.8.0? ... yes Ruby version >= 2.3.5 ? ... yes (2.5.3) Git version >= 2.18.0 ? ... yes (2.18.1) Git user has default SSH configuration? ... yes Active users: ... 6

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished