requirements
- Cloud SDK
gcloud container clusters create examhall --machine-type g1-small --num-nodes 2 --enable-autoscaling --min-nodes 2 --max-nodes 5 --zone asia-east1-b
gcloud config set container/cluster examhall
gcloud container clusters get-credentials examhall
kubectl apply -f core.yaml
kubectl apply -f ui.yaml
kubectl create configmap nginx-config --from-file=default.conf
kubectl apply -f nginx.yaml
kubectl get pods -l app=examhall -o wide
give Container Builder Service Account container.developer
role access to your Kubernetes Engine clusters
PROJECT="$(gcloud projects describe \
$(gcloud config get-value core/project -q) --format='get(projectNumber)')"
gcloud projects add-iam-policy-binding $PROJECT \
--member=serviceAccount:$PROJECT@cloudbuild.gserviceaccount.com \
--role=roles/container.developer
- push to GitHub with tag
- trigger build image in GCR
- run cloudbuild.yaml to build steps
- apply Kubernetes configuration files
kubectl delete configmap nginx-config
kubectl delete --all svc
kubectl delete --all deployment
gcloud container clusters delete examhall
requirements
- Docker
docker-compose build
docker-compose up -d
docker-compose rm -s