Activity: Using the Kubernetes Go Client inside the Cluster

Scenario

You are assigned the task of deploying a Go application that lists all of the pods in Kubernetes. Besides this, the application will run inside the cluster and receive information about its cluster.

Aim

To run an application that consumes the Go client library inside the Kubernetes cluster.

Prerequisites

  1. Use the Docker image onuryilmaz/k8s-client-example:go image, which contains the executable from the previous example.
  2. Deploy the application and check the logs to see whether it is working as expected.

Steps for Completion

  1. Create a deployment with the Docker image of the example client from the previous example.
  2. Wait until the pod is running.
  3. Get the logs of the deployment pod.

With this command, the logs of the pod are retrieved with a subcommand. In the subcommand, all pods are retrieved with the selector label of run equal to go-client, and the name of the first pod is gathered. Logs should indicate the client itself, in addition to other pods in the cluster:

  1. Run the following command for cleanup:
kubectl delete deployment go-client
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.77.4