Wordpress
Set up
- gcloud components update preview
- gcloud config set account deraru@example.com
- gcloud auth login
- gcloud init my-project-id
- cd ~/my-project-id
- gcloud config set compute/zone asia-east1-c
Create Wordpress website
- gcloud preview container clusters create my-cluster-name –num-nodes 1 –machine-type g1-small
- gcloud preview container pods create –name my-pod-name –image tutum/wordpress –port 80
- gcloud compute firewall-rules create my-firewall-name –allow tcp:80 –target-tags k8s-my-cluster-name-node
Check the website
- gcloud preview container pods list
- http://host-ip-address
Clean up
- gcloud preview container clusters delete my-cluster-name
- gcloud compute firewall-rules delete my-firewall-name
Reference
Guestbook
Setup
- wget https://cloud.google.com/container-engine/docs/downloads/guestbook.zip
- unzip guestbook.zip
Create Guestbook web service
- gcloud preview container clusters create my-cluster-name
- gcloud preview container pods create –config-file redis-master-pod.json
- gcloud preview container services create –config-file redis-master-service.json
- gcloud preview container replicationcontrollers create –config-file redis-worker-controller.json
- gcloud preview container services create –config-file redis-worker-service.json
- gcloud preview container replicationcontrollers create –config-file guestbook-controller.json
- gcloud preview container services create –config-file guestbook-service.json
- gcloud compute firewall-rules create my-firewall-name –allow tcp:3000 –target-tags k8s-my-cluster-name-node
Check the web service
- gcloud compute forwarding-rules list
- http://forwarding-rule-ip-address:3000
Clean up
- gcloud preview container clusters delete my-cluster-name
- gcloud compute forwarding-rules delete guestbook
- gcloud compute target-pools delete guestbook
- gcloud compute firewall-rules delete my-firewall-name
Reference
Connect to VM
- gcloud compute ssh my-vm-name