Feedback

Chat Icon

Helm in Practice

Designing, Deploying, and Operating Kubernetes Applications at Scale

Creating, Developing, and Testing a Helm Chart
51%

Creating a Testing Pod

When our application is deployed, we want to make sure it's working correctly. We can create a simple testing Pod that will try to connect to our application and verify that it's running. The application uses port 8080, so we will create a Pod that uses the curl image to connect to our application using its ClusterIP service.

Our application exposes a single endpoint, /tasks, that returns the list of tasks in JSON format. We can use it to verify that our application is running correctly. Therefore, the test Pod will use the following command to connect to our application:

curl -f http://:/tasks

The is the name of the service created by the chart, which can be obtained using the Helm helper function {{ include "todo-chart.fullname" . }}, as defined in the service template:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "todo-chart.fullname" . }} # This is the service name
  labels:
    {{- include "todo-chart.labels" . | nindent 4 }}
spec:
  type: {{ .Values.service.type }}
  ports:
    - port: {{ .Values.service.port }}
      targetPort: http
      protocol: TCP
      name: http
  selector:
    {{- include "todo-chart.selectorLabels" . | nindent 4 }}

The can be obtained from the values.yaml file as {{ .Values.service.port }}.

This is how the test Pod manifest looks:

cat < $HOME/todo-chart/templates/tests/test-connection.yaml

Helm in Practice

Designing, Deploying, and Operating Kubernetes Applications at Scale

Enroll now to unlock current content and receive all future updates for free. Your purchase supports the author and fuels the creation of more exciting content. Act fast, as the price will rise as the course nears completion!

Unlock now  $15.99$11.99

Hurry! This limited time offer ends in:

To redeem this offer, copy the coupon code below and apply it at checkout:

Learn More