Kubernetes Environment

This section will explain about the project build around the Kubernetes environment within GCP.

Setting Up kubectl and gcloud CLI

Below are the steps to initialize kubectl and gcloud cli to your local machine.
  1. Install kubectl command-line tool. Choose your platform and follow the steps from https://kubernetes.io/docs/tasks/tools/
  2. Install gcloud CLI. Follow the steps in https://cloud.google.com/sdk/docs/install. This is required later to authorize you to the GCP and fetch the kube config from the GKE
  3. run gcloud auth login to authorize gcloud to access the GCP provided to your email address
  4. run gcloud config set project provider-serverless to set the active project to the development and staging environment
  5. run gcloud container clusters get-credentials dev-app-cluster-clone-1 --region=asia-southeast1 . This command will fetch the kubeconfig and add it to your config at $HOME/.kube/config and enables the kubectl command to connect to the Kubernetes environment in the GCP
  6. If you need the kubeconfig to the production environment in unoseamless project, repeat step 4 using unoseamless project name and repeat step 5 with dev-app-cluster cluster name
  7. Congratulation! Now you can use the kubectl command to manage the Kubernetes environment with the CLI. Learn the CLI further from the kubectl documentation

Setting Up Lens for Monitoring

To monitor and manage the deployments in the Kubernetes environment, Lens offers a full features IDE with simple installation and is available in multiple platform. Follow Lens documentation to install it in your local machine

With kubectl and gcloud CLI installed, you can now use Lens to view the Kubernetes environment through an IDE instead of wandering around the terminal.
  1. Install Lens from the official website at https://k8slens.dev/
  2. After successfully authenticate your account, you will see a list of different resource. If you already have a kubeconfig configuration in your system, you will see the cluster with a kind of KubernetesCluster
  3. On the cluster, click the option and click on Settings
  4. Go to proxy section and fill the HTTP Proxy value with http://localhost:8888
  5. Go back to the Catalog Browse page and click on the cluster. Now you should be able to access the cluster from Lens