Hello World from OSS Silicon Valley


HowToUse/Kubernetes/1.12/GKE

_ Prerequisite

  • Gmail account creation

_ Install&Setup

Step.1
Open google cloudshell and create project
Step.2
Set default project name and computing zone
$ gcloud config set project <Project Name>
$ gcloud config set compute/zone <Compute Zone>

(example)

$ gcloud config set project test
$ gcloud config set compute/zone us-west1-a
Step.3
Create clusterand get credential info
$ gcloud container clusters create <Cluster Name>
$ gcloud container clusters get-credentials <Cluster Name>

(example)

$ gcloud container clusters create sample
$ gcloud container clusters get-credentials sample

_ HowToUse

_ Deployment

Step.1
Deploy application
$ kubectl run <Deployment Name> --image <Image Name> --port <PortNum>

(example)

$ kubectl run hello-server --image gcr.io/google-samples/hello-app:1.0 --port 8080
Step.2
Expose application
$ kubectl expose deployment <Deploy Name> --type "LoadBalancer"

(example)

$ kubectl expose deployment hello-server --type "LoadBalancer"
Step.3
Check external IP and access to the application
$ kubectl get service <Deploy Name>

(example)

$ kubectl get service hello-server

Then you should be able to access deployed application from the following URL.

http://<External IP>:8080

_ Resize

Step.1
You can stop/start service by changing the number of node.

(stop)

$ gcloud container clusters resize <Cluster Name> --size=0

(restart)

$ gcloud container clusters resize <Cluster Name> --size=3 --zone us-west1-a

_ Author

S.Yatsuzuka

[ back ]
Last-modified: 2019-08-25 (Sun) 02:26:45 (2007d)