Commands that are useful for doing stuff on Google Container Engine
$ gcloud config set project PROJECT_ID
$ gcloud config set compute/zone ZONE_NAME
$ gcloud container clusters list
$ gcloud container clusters get-credentials CLUSTER_NAME
-
Build container
$ docker build -t gcr.io/PROJECT_ID/APP_NAME:APP_VERSION
-
Push container to Google image registry
$ gcloud docker push gcr.io/PROJECT_ID/APP_NAME:APP_VERSION
-
Deployment config file (e.g.
deployment.yaml
)apiVersion: extensions/v1beta1 kind: Deployment metadata: name: DEPLOYMENT_NAME spec: replicas: 2 template: metadata: labels: app: APP_NAME spec: containers: - name: APP_NAME image: gcr.io/PROJECT_ID/APP_NAME:APP_VERSION ports: - containerPort: CONTAINER_PORT
-
Create the deployment
$ kubectl create -f deployment.yaml
-
Service config file
apiVersion: v1 kind: Service metadata: name: SERVICE_NAME spec: type: LoadBalancer ports: - port: 80 targetPort: 3000 selector: app: APP_NAME