ruk·si

Google Cloud

Updated at 2017-08-31 21:29

Install Google Cloud SDK.

# login to your account and make sure it is active
gcloud auth login
gcloud auth list

# make sure you can see the project you are working with
gcloud projects list

# set the project as your default project
gcloud config set project decent-essence-123456

# find the Kubernetes cluster that is hosting your service
gcloud container clusters list
# NAME            ZONE            MASTER_VERSION  MASTER_IP        MACHINE_TYPE
# webserver-prod  europe-west1-d  1.6.7           xxx.xxx.xxx.xxx  g1-small
gcloud container clusters describe webserver-prod

# install Kubernetes
brew install kubectl

# setup cluster reference to kubectl
gcloud container clusters get-credentials webserver-prod

kubectl cluster-info
# Kubernetes master is running at https://xxx.xxx.xxx.xxx

# create a static IP for the HTTPS frontend
gcloud compute addresses create webserver-prod-static-ip --global

WORK IN PROGRESS...

  • https://cloud.google.com/container-engine/docs/tutorials/http-balancer

Create webserver-prod-ingress.yaml file

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: webserver-prod-ingress
  annotations:
    kubernetes.io/ingress.global-static-ip-name: webserver-prod-static-ip
spec:
  backend:
    serviceName: webserver-prod-lb
    servicePort: 80
kubectl apply -f webserver-prod-ingress.yaml
kubectl get ingress webserver-prod-ingress
kubectl delete ingress webserver-prod-ingress

# - Go to
#   https://console.cloud.google.com/net-services/loadbalancing/loadBalancers/list
#   and find the new balancer with `webserver-prod-ingress` in the name.
# - Edit it and go to frontend config.
# - Delete the HTTP frontend.
# - Add new frontend with HTTPS as Protocol and set the certificate.