Skip to content

Instantly share code, notes, and snippets.

@tvvignesh
Created December 22, 2019 17:46
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save tvvignesh/e82bc33469320aa198c348336b4890fb to your computer and use it in GitHub Desktop.
Save tvvignesh/e82bc33469320aa198c348336b4890fb to your computer and use it in GitHub Desktop.
Example on running Skaffold with GITLAB CI for Kubernetes in GKE (Make sure you modify it appropriately and set GCP_SERVICE_KEY and GCP_PROD_SERVICE_KEY variable in Gitlab with the service account json value)
services:
- docker:dind
stages:
- development
- production
variables:
DOCKER_DRIVER: overlay2
DOCKER_TLS_CERTDIR: ''
DOCKER_HOST: tcp://docker:2375
development:
image:
name: gcr.io/k8s-skaffold/skaffold:latest
stage: development
script:
- echo "$GCP_SERVICE_KEY" > gcloud-service-key.json
- gcloud auth activate-service-account --key-file gcloud-service-key.json
- gcloud config set project project-dev
- gcloud config set compute/zone asia-south1-a
- gcloud container clusters get-credentials cluster-dev
- kubectl config get-contexts
- skaffold run
only:
- master
production:
image:
name: gcr.io/k8s-skaffold/skaffold:latest
stage: production
script:
- echo "$GCP_PROD_SERVICE_KEY" > gcloud-service-key.json
- gcloud auth activate-service-account --key-file gcloud-service-key.json
- gcloud config set project project-prod
- gcloud config set compute/zone asia-south1-a
- gcloud container clusters get-credentials cluster-prod
- kubectl config get-contexts
- skaffold run -p production
only:
- production
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment