Skip to content

How to deploy to a new Google cluster

Filippo Ledda edited this page Apr 22, 2021 · 1 revision

General steps:

  1. Create a new cluster in GCP.
  2. Install the prerequisites in the newly created cluster.
  3. Create a new pipeline in Codefresh to automate deployments.
  4. Deploy.

1. Create a new cluster in GCP

The cluster can be created in the GCP console. Define a node pool that satisfies application requirements. The node pool can be always scaled to have a different node number, so the only important choice is the node type. Also other node pools can be added at any point of time to the cluster to replace the original one.

After creating the cluster, use gcloud command line client to get the credentials in your machine:

  • gcloud init
  • gcloud container clusters get-credentials --zone us-central1-a <CLUSTER_NAME>

2. Install the prerequisites in the newly created cluster

Helm

Helm 3 is used to deploy MNP. Install Helm and ensure is working on your command line.

Cert-manager

Follow this instructions to deploy cert-manager

Important! Use the helm chart installation and set use-webhook to false. The webhook causes some issues to create certificates

helm install --name cert-manager --namespace cert-manager --version v0.14.0 jetstack/cert-manager --set webhook.enabled=false

nginx-ingress

Ingress controller is the entry point of all cloudharness applications. Info on how to deploy nginx-ingress can be found here.

helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo update
helm install ingress-nginx ingress-nginx/ingress-nginx

The nginx-ingress chart will deploy a Load Balancer with a given IP address. Use that address to create the CNames and A records for the website.

3. Create a new pipeline in Codefresh to automate deployments.

We are using a codefresh yaml file generated in the repository, so the only thing you need to do is to point to that codefresh.yaml file at the moment of creating the pipeline.

Select "use yaml from repository" There are 2 pipelines to choose:

  1. ./deployment/codefresh-dev.yaml - builds and deploys
  2. ./deployment/codefresh-prod.yaml - deploys from a previous tagged build

Add the new cluster to codefresh

  1. Go to Codefresh under Account Settings > kubernetes and choose to add custom cluster.
  2. Follow the instructions to get the host, token, etc.

Configure the deployment variables

On your codefresh pipeline, configure variables to specify the cluster, registry and other custom values.

4. Deploy

Go to codefresh webpage and in Pipelines click RUN.