This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl --namespace=production set image deployment/kubeapp-production kubeapp=gcr.io/$PROJECT_ID/app:2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ for i in `seq 1 10`; do curl http://$SERVICE_IP/version; sleep 1; done | |
1.0 | |
1.0 | |
1.0 | |
2.0 | |
1.0 | |
2.0 | |
1.0 | |
2.0 | |
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Parse PROJECT_ID in k8s config | |
$ sed -i.bak "s#PROJECT_ID#$PROJECT_ID#" app-canary.yml | |
$ kubectl --namespace=production apply -f app-canary.yml | |
deployment "kubeapp-canary" created | |
$ kubectl --namespace=production get pods | |
NAME READY STATUS RESTARTS AGE | |
kubeapp-canary-469258524-2qjk0 1/1 Running 0 32s | |
kubeapp-production-1443420586-58njk 1/1 Running 0 1h |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Deployment | |
apiVersion: extensions/v1beta1 | |
metadata: | |
name: kubeapp-canary | |
spec: | |
replicas: 1 | |
template: | |
metadata: | |
name: kubeapp | |
labels: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export app_version=2.0 | |
$ docker build --build-arg version=$app_version -t gcr.io/$PROJECT_ID/app:$app_version . | |
Sending build context to Docker daemon 16.48MB | |
Step 1/6 : FROM alpine:latest | |
---> 7328f6f8b418 | |
Step 2/6 : MAINTAINER The Dockbit Team "team@dockbit.com" | |
---> Using cache | |
---> 6abecc069f97 | |
Step 3/6 : ARG version=1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export SERVICE_IP=$(kubectl --namespace=production get service/app-lb --output=json | jq -r '.status.loadBalancer.ingress[0].ip') | |
$ curl http://$SERVICE_IP/ | |
Congratulations! Version 1.0 of your application is running on Kubernetes. | |
$ curl http://$SERVICE_IP/version | |
1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl --namespace=production get services | |
NAME CLUSTER-IP EXTERNAL-IP PORT(S) AGE | |
app-lb 10.63.250.99 35.196.71.189 80:32250/TCP 2m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl --namespace=production apply -f app-lb.yml | |
service "app-lb" created |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: app-lb | |
spec: | |
type: LoadBalancer | |
ports: | |
- name: http | |
port: 80 | |
targetPort: 8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ kubectl --namespace=production get pods -o wide | |
NAME READY STATUS RESTARTS AGE IP NODE | |
kubeapp-production-1979975788-8gkxn 1/1 Running 0 1m 10.60.2.7 gke-canary-default-pool-f3096f17-76ld | |
kubeapp-production-1979975788-m5v7r 1/1 Running 0 1m 10.60.0.9 gke-canary-default-pool-f3096f17-g4fc | |
kubeapp-production-1979975788-phhkw 1/1 Running 0 1m 10.60.1.7 gke-canary-default-pool-f3096f17-lxqs |