==== 2: GKE ====== gcloud config set compute/zone us-central1-b gcloud container clusters create [CLUSTER-NAME] gcloud container clusters get-credentials [CLUSTER-NAME] kubectl run hello-server --image=gcr.io/google-samples/hello-app:1.0 --port 8080 kubectl expose deployment hello-server --type="LoadBalancer" kubectl get service hello-server gcloud container clusters delete [CLUSTER-NAME] ======= 3: Orchestrating ======= gcloud container clusters create io git clone https://github.com/googlecodelabs/orchestrate-with-kubernetes.git kubectl run nginx --image=nginx:1.10.0 kubectl get pods kubectl expose deployment nginx --port 80 --type LoadBalancer kubectl create -f pods/monolith.yaml kubectl describe pods monolith kubectl port-forward monolith 10080:80 TOKEN=$(curl http://127.0.0.1:10080/login -u user|jq -r '.token') curl -H "Authorization: Bearer $TOKEN" http://127.0.0.1:10080/secure kubectl exec monolith --stdin --tty -c monolith /bin/sh kubectl label pods secure-monolith 'secure=enabled' kubectl get pods secure-monolith --show-labels gcloud compute instances list curl -k https://:31000 # deployment kubectl create -f deployments/auth.yaml ========= 4: managing deployment using GKE gcloud container clusters create bootcamp --num-nodes 5 --scopes "https://www.googleapis.com/auth/projecthosting,storage-rw" kubectl create secret generic tls-certs --from-file tls/ kubectl create configmap nginx-frontend-conf --from-file=nginx/frontend.conf kubectl create -f deployments/frontend.yaml kubectl create -f services/frontend.yaml kubectl get services frontend curl -ks https:// curl -ks https://`kubectl get svc frontend -o=jsonpath="{.status.loadBalancer.ingress[0].ip}"` kubectl scale deployment hello --replicas=5 kubectl get pods | grep hello- | wc -l kubectl edit deployment hello kubectl rollout pause deployment/hello kubectl rollout status deployment/hello kubectl get pods -o jsonpath --template='{range .items[*]}{.metadata.name}{"\t"}{"\t"}{.spec.containers[0].image}{"\n"}{end}' kubectl rollout resume deployment/hello ====== 5: jenkins git clone https://github.com/GoogleCloudPlatform/continuous-deployment-on-kubernetes.git gcloud container clusters create jenkins-cd \ --num-nodes 2 \ --machine-type n1-standard-2 \ --scopes "https://www.googleapis.com/auth/projecthosting,cloud-platform" wget https://storage.googleapis.com/kubernetes-helm/helm-v2.9.1-linux-amd64.tar.gz tar zxfv helm-v2.9.1-linux-amd64.tar.gz cp linux-amd64/helm . kubectl create clusterrolebinding cluster-admin-binding --clusterrole=cluster-admin --user=$(gcloud config get-value account) kubectl create serviceaccount tiller --namespace kube-system kubectl create clusterrolebinding tiller-admin-binding --clusterrole=cluster-admin --serviceaccount=kube-system:tiller ./helm init --service-account=tiller ./helm update ./helm install -n cd stable/jenkins -f jenkins/values.yaml --version 0.16.6 --wait kubectl get pods export POD_NAME=$(kubectl get pods -l "component=cd-jenkins-master" -o jsonpath="{.items[0].metadata.name}") kubectl port-forward $POD_NAME 8080:8080 >> /dev/null & kubectl get svc printf $(kubectl get secret cd-jenkins -o jsonpath="{.data.jenkins-admin-password}" | base64 --decode);echo cd sample-app 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 kubectl scale deployment gceme-frontend-production -n production --replicas 4 kubectl get pods -n production -l app=gceme -l role=frontend kubectl get pods -n production -l app=gceme -l role=backend kubectl get service gceme-frontend -n production export FRONTEND_SERVICE_IP=$(kubectl get -o jsonpath="{.status.loadBalancer.ingress[0].ip}" --namespace=production services gceme-frontend) gcloud alpha source repos create default kubectl proxy &