Register Google GKE Cluster

In case of gopaddle community edition, the installer automatically registers the local Kubernetes cluster in gopaddle. Ignore this section if you are running a community edition

In case of SaaS or Enterprise edition, this section needs to be followed to register a cluster

  1. Install gcloud CLI in your local environment

  2. Install jq. For instance, you can install jq in Ubuntu environments, as below:

apt update
apt install jq
  1. Login to your Google Cloud account using gcloud command line utility. For more information check out - https://cloud.google.com/sdk/gcloud/reference/auth

gcloud auth login
  1. Describe the GKE cluster and get the Cluster CA Certificate.

gcloud container clusters describe <clustername> --zone <cluster-zone> --project <project-name> --format json | jq '.masterAuth.clusterCaCertificate'
  1. Edit the Kubeconfig file below by replacing the values gathered in the previous step.

apiVersion: v1
clusters:
- cluster:
    certificate-authority-data: <clusterCaCertificate>
    server: <server-end-point>
  name: gke_<project>_<zone>_<clustername>
contexts:
- context:
    cluster: gke_<project>_<zone>_<clustername>
    user: gke_<project>_<zone>_<clustername>
  name: gke_<project>_<zone>_<clustername>
current-context: gke_<project>_<zone>_<clustername>
kind: Config
preferences: {}
users:
- name: gke_<project>_<zone>_<clustername>
  user:
    auth-provider:
      name: gcp

If you don't have a Bastion Host setup, and if the server value in the Kubeconfig points to a private IP address:

a) Replace the server value to a publicly accessible Cluster Master API Endpoint

b) Make sure the firewall is open for the Cluster Master API port

c) Make sure the Cluster certificate is attached to the Public IP. Here is an example of how to update the certSANs with the public IP. - https://blog.scottlowe.org/2019/07/30/adding-a-name-to-kubernetes-api-server-certificate/

  1. Navigate to the Environments section.

  2. Click on Add a Cluster and choose Register an existing Cluster.

  3. Provide the Google GKE Cluster name. The cluster name must match the cluster name in the Google portal.

  4. Choose the Cloud provider as Google. Select the Cloud Account and the Google project ID and the Regions.

  1. In the Authentication Step, upload the Kubeconfig file gathered in step 2.

  1. If you have configured a bastion host, provide the Bastion Host IP, SSH Pem file, SSH port

If you are using a Bastion Host setup, make sure the Bastion Host IP and Port are accessible publicly. If you are looking for a private only setup, get in touch with us to explore gopaddle Enterprises.

  1. Click on Finish to register the GKE Cluster.

Last updated