A Quick Guide to Connect GKE Cluster from CentOS 8 / RHEL 8

To connect to a Google Kubernetes Engine (GKE) cluster from a CentOS 8 / RHEL 8 host machine, you can follow these general steps. Please note that you should have the Google Cloud SDK (gcloud) installed and configured on your CentOS 8 / RHEL 8 machine to interact with GKE clusters.

Here are the steps:

Install Google Cloud SDK:

If you haven’t already, you need to install the Google Cloud SDK on your CentOS 8 / RHEL 8 machine. You can do this by following the official documentation: https://cloud.google.com/sdk/docs/install

Initialize the SDK: After installation, you should initialize the Google Cloud SDK by running the following command in your terminal:

$ gcloud init

This command will guide you through the setup process, which includes:

  • Logging in with your Google account.
  • Selecting or creating a GCP project.
  • Setting the default configuration, which includes the project ID, region, and zone.
  • Authentication: You’ll be prompted to authenticate yourself using your Google account credentials. Follow the instructions provided during the authentication process.

Authenticate and Set Default Project:

Run the following commands to authenticate with your Google Cloud account and set your default project:

$ gcloud auth login

To list your GCP projects:

$ gcloud projects list

To set a default project if it’s not already set:

$ gcloud config set project PROJECT_ID

To list your Compute Engine instances:

$ gcloud compute instances list

Replace PROJECT_ID with your actual Google Cloud project ID.

Install kubectl:

kubectl is the Kubernetes command-line tool that you will use to interact with your GKE cluster. You can install it on CentOS 8 / RHEL 8 using the following commands:

$ sudo yum install -y kubectl

Get Credentials for the Cluster:

To configure kubectl to use your GKE cluster, run the following command:

$ gcloud container clusters get-credentials CLUSTER_NAME --zone ZONE_NAME

Replace CLUSTER_NAME with the name of your GKE cluster and ZONE_NAME with the zone where your cluster is located.

Verify Connection:

You can verify that you’re connected to your GKE cluster by running a simple kubectl command, such as:

$ kubectl get nodes

This should display a list of the nodes in your GKE cluster.

Now, you have successfully connected to your GKE cluster from your CentOS 8 / RHEL 8 host machine. You can use kubectl to manage and interact with your Kubernetes cluster as needed. Remember to configure your Kubernetes resources and access controls based on your application’s requirements.

References:

https://kubernetes.io/docs/
https://www.redhat.com/en/topics/containers/what-is-kubernetes
https://www.ibm.com/topics/kubernetes
https://www.infoworld.com/article/3268073/what-is-kubernetes-your-next-application-platform.html

 

Avatar photo

Asif Khan

Responsible and proactive professional with more than 13 years of experience in IT systems, open source software applications, DevOps, Linux systems, and cloud operations. My main goals are to automate things, keep them safe, and make sure they are strong. I am very good at planning and building the infrastructure for services that people really want. I was drawn to the fast-paced world of cloud computing because it has resources that can be scaled up or down as needed. One of my best skills is being able to use a lot of different DevOps tools to set up, release management, and microservices ecosystems, as well as for provisioning, orchestration, and configuration management.