Skip to content

Instantly share code, notes, and snippets.

@kokospapa8
Last active August 30, 2020 15:45
Show Gist options
  • Select an option

  • Save kokospapa8/efa6f4272c9c63f2f75ff2a939fd09db to your computer and use it in GitHub Desktop.

Select an option

Save kokospapa8/efa6f4272c9c63f2f75ff2a939fd09db to your computer and use it in GitHub Desktop.
GSP 330
Task1
# SSH into jumphost
cd /work/sample-app
gcloud config set compute/zone us-east1-d
gcloud container clusters get-credentials jenkins-cd --zone us-east1-b
kubectl create ns production
kubectl apply -f k8s/production -n production
kubectl apply -f k8s/canary -n production
kubectl apply -f k8s/services -n production
# in gcloud shell
gcloud config set compute/zone us-east1-d
gcloud container clusters get-credentials jenkins-cd --zone us-east1-b
printf $(kubectl get secret cd-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo
export POD_NAME=$(kubectl get pods --namespace default -l "app.kubernetes.io/component=jenkins-master" -l "app.kubernetes.io/instance=cd" -o jsonpath="{.items[0].metadata.name}")
kubectl port-forward $POD_NAME 8080:8080 >> /dev/null &
#access using web preview of cloud shell
# login with admin/ password from above
# set service account metadata
# https://8080-dot-13839724-dot-devshell.appspot.com/credentials/store/system/domain/_/newCredentials
# configure jenkins following same step in https://www.qwiklabs.com/focuses/1104 section Creating the Jenkins Pipeline
---
Task2
git checkout -b development
# update
# main.go and html.go as request
git add html.go main.go
git commit -m "Version 2.0.0"
git push origin development
# wait for jenkins deployment
curl http://localhost:8001/api/v1/proxy/namespaces/develpment/services/gceme-frontend:80/proxy/version
# confirm 2.0.0 on response
---
Task 3
git checkout -b canary
git push origin canary
---
Task 4
git checkout master
git merge canary
git push origin master
@kokospapa8
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment