Skip to content

Cluster Configuration

Leonardo Espinosa Torres edited this page Apr 24, 2018 · 6 revisions

Production Cluster Configuration

This steps allow configure cluster in Google Container Engine.

Note: You have create cluster in Google Container Engine previously

  • List container clusters
gcloud container clusters list
  • Set Zone in GCloud
gcloud config set compute/zone us-east1-d
  • Get cluster credentials
gcloud container clusters get-credentials cl-cyg-prd
  • Install kubectl (Kubernetes cli)
gcloud components install kubectl
  • List docker image tags in GCloud
gcloud container images list-tags gcr.io/comeygana-201900/prdcyg
  • Run docker image in google container engine with kubernetes (the label is for deployment and service) Note: label must consist of lower case alphanumeric characters or '-', and must start and end with an alphanumeric character (e.g. 'my-name', or '123-abc', regex used for validation is 'a-z0-9?')
kubectl run <label> --image=gcr.io/comeygana-201900/prdcyg:<v0.0.0> --port=8080
kubectl run prdcyg-node --image=gcr.io/comeygana-201900/prdcyg:v1.0.0 --port=8080
  • Get cluster pods (pod = cluster node)
kubectl get pods
  • Create load balancer in cluster and expose nodes
kubectl expose deployment <label> --type="LoadBalancer"
kubectl expose deployment prdcyg-node --type="LoadBalancer"
  • Get external IP to access the cluster:
kubectl get services
  • Create Ingress resource prdcyg-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: prdcyg-ingress
spec:
  backend:
    serviceName: prdcyg-node
    servicePort: 8080
  • Deploy ingress resource
kubectl apply -f prdcyg-ingress.yaml
  • Find out the external IP address
kubectl get ingress prdcyg-ingress
  • [SSL_CERTIFICATE]: the name you want to give the certificate resource
  • [CRT_FILE_PATH]: the path and filename of your certificate file (.crt file)
  • [KEY_FILE_PATH]: the path and filename of your key file (.key file)
gcloud compute ssl-certificates create [SSL_CERTIFICATE] \
    --certificate [CRT_FILE_PATH] \
    --private-key [KEY_FILE_PATH]
  • Show certificates
gcloud compute ssl-certificates describe [SSL_CERTIFICATE]
gcloud compute ssl-certificates list
Clone this wiki locally