Monday, January 6, 2020

Kubernetes: Deploy Application

https://cloud.google.com/kubernetes-engine/docs/tutorials/hello-app

git clone https://github.com/GoogleCloudPlatform/kubernetes-engine-samples
cd kubernetes-engine-samples/hello-app
export PROJECT_ID=feipoc

Build and publish docker image

docker build -t feijiangnan/${PROJECT_ID}/hello-app:v1 .

docker push feijiangnan/${PROJECT_ID}/hello-app:v1

 docker push feijiangnan/feipoc:v1
The push refers to repository [docker.io/feijiangnan/feipoc]
29696f6ceea7: Pushed
6b27de954cca: Pushed
v1: digest: sha256:46c0116c6a4f0e90350e9dabed603d28c7c9775bd354c38eac18ccc9c99d502c size: 739

Create Deployment

kubectl create deployment hello-web --image=docker.io/feijiangnan/feipoc:v1

Delete Deployment

kubectl delete deployment hello-web
kubectl create deployment hello-web --image=docker.io/feijiangnan/feipoc:v1

Validate Deployment

kubectl describe pod hello-web-848b6b9bd-4vbz5
kubectl get pod

kubectl expose deployment hello-web --type=LoadBalancer --port 80 --target-port 8080

Scale Out Deployment

kubectl scale deployment hello-web --replicas=3

Display the prior Deployments

kubectl rollout history deployment hello-web

Restore last Deployment

kubectl rollout undo deployment hello-web

No comments:

Post a Comment