In this section, we'll deploy a Python application that lists all of the pods and consumes the Python client library inside Kubernetes. Besides this, the application will run inside the cluster and gather information about its cluster.
Before starting with the implementation, we need to use the Docker image onuryilmaz/k8s-client-example:python, which was built using the Dockerfile in the last section. We also need to deploy the application as a deployment and check the logs to see whether it is working as expected. Let's begin by implementing the following steps:
- Create a deployment with the Docker image of the example client:
kubectl run python-client -it --image=onuryilmaz/k8sclient-example:python
With this command, a deployment with the name python-client will be created with the Docker image onuryilmaz/k8s-client-example:python in an interactive mode so that logs will be printed to the console.
Logs should indicate the client itself, in addition to other pods in the cluster:
- Run the following command for cleanup:
kubectl delete deployment python-client