Skip to content

New Cluster Configuration

Leonardo Espinosa Torres edited this page Oct 19, 2017 · 3 revisions

Testing 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-tsti4t
  • Install kubectl (Kubernetes cli)
gcloud components install kubectl
  • List docker image tags in GCloud
gcloud container images list-tags gcr.io/pr-tsti4t/tsti4t
  • 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/pr-tsti4t/tsti4t:<v0.0.0> --port=8080
kubectl run tsti4t-node --image=gcr.io/pr-tsti4t/tsti4t: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 tsti4t-node --type="LoadBalancer"
  • Get external IP to access the cluster:
kubectl get services
  • Create Ingress resource tsti4t-ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: tsti4t-ingress
spec:
  backend:
    serviceName: tsti4t-node
    servicePort: 8080
  • Deploy ingress resource
kubectl apply -f tsti4t-ingress.yaml
  • Find out the external IP address
kubectl get ingress tsti4t-ingress
Clone this wiki locally