Getting Started#
This chapter covers installing the chart and deploying your first container image.
Requierments#
To work with this Helm chart locally, you need a few tools installed:
Quick overview#
Helm is a package manager and template-rendering installer for Kubernetes resources.
Kubernetes works with YAML files, which are applied to a cluster, e.g. by using a tool like Helm or kubectl. The most basic way of installing anything in Kubernetes is kubectl apply -f my-config.yaml.
Helm provides a templating mechanism and helper functions to package YAML files into re-usable bundles called Helm Charts.
A Helm Chart is a set of Templates which render to plaintext YAML.
These YAML files are then installed in the Kubernetes cluster and create the resources like Deployments, Service, Ingress, etc. - this is done by Helm as well.
So with Helm, the install command is:
helm install <release-name> <repo/chart> -f values.yaml
# e.g.
# helm install my-app kloudease/workload-helm -f values.yaml
values.yaml contains only the app specific config and repo/chart contains all the reusable templates.
Add the Helm Repository#
If you want to test your changes locally, the helm repository must be added first.
Run the following command
# Obtain a GitLab access token, then:
helm repo add kloudease \
--username "pat" \
--password "$GITLAB_TOKEN" \
https://gitlab.kloudease.tech/api/v4/projects/105/packages/helm/stable
helm repo update
GITLAB_TOKEN can be obtained from the kloudease Team.
This is only required if you want to render the helm chart locally, e.g for testing changes to values.yaml.
Your First Deployment#
Create a file called values.yaml with the minimum required configuration:
image:
repository: <your-image> # e.g. registry.project.com/my-app
tag: <your-tag> # e.g. 1.0.0
Then run helm template to see the rendered YAML:
helm template my-app kloudease/workload-helm -f values.yaml
- A Deployment with 1 replica running
<your-image>:<your-tag> - A ClusterIP Service exposing port 80
- Default liveness, readiness, and startup probes (TCP socket on port 80)
Scaling Replicas#
To deploy multiple instances of your app for redundancy, add the following into values.yaml:
application:
replicas: 3
For automatic scaling, see Observability & Scaling.
Setting Resource Requests and Limits#
The Kubernetes engine works best when resource requests and limits are set. This helps Kubernetes determine where to place an application, and when to move it to a different node (server).
Resources are very individual and depend on the type of application: A Java App which parses PDF files needs more than a Go application serving static HTML files - you as the developer know your application best and should set limits accordingly.
Don't know where to start? Choose something and adjust from there, take a look at the metrics in Perses, and see if your app runs smoothly. If it doesn't, adjust the values and look again.
A note on CPU limits: CPU limits can slow down your application because the app will not use more than it's limit even if CPU is available. Often times the cpu limit can be omitted, and the request should be set to a sensible default for your app.
Memory (RAM) requests and limits should always be configured, since a rogue application can easily take over all available RAM, effectively blocking all other apps on the same host.
resources:
requests:
cpu: 100m
memory: 128Mi
limits:
cpu: 500m
memory: 512Mi
Using a Private Registry#
Images can be pulled from public registries, such as docker.io, or private registries, such as a private Gitlab instance.
A private registry requires a Pull Secret, which contains authentication information for the registry.
image:
repository: registry.example.com/my-team/my-app
tag: "v2.1.0"
pullPolicy: IfNotPresent
imagePullSecrets:
- name: my-registry-credentials
image.pullPolicy specifies when an image is pulled from the registry. Kubernetes has some defaults depending on the image tag used.
We strongly recommend always using tagged images, and never using latest. Even during development, you should tag your images, when building the image in Gitlab CI you can use the $CI_COMMIT_SHA for example to create a reproducable ID for each build.
Naming#
The chart generates resource names from the Helm release name and the chart name. You can override this:
global:
# Override the name prefix (default: chart name `workload-helm`)
nameOverride: my-app
# Override the full name entirely
fullnameOverride: my-custom-name
We recommend setting global.fullnameOverride to the name of your service. This way everything is named as you would expect, and still unique. If you do not set global.fullnameOverride the names will looks similar to my-app-workload-helm.
Let's assume an app named customer-postbox, installed with helm install customer-postbox ... - here's the different names:
# global.fullnameOverride: ""
helm install customer-postbox kloudease/workload-helm -f values.yaml
# name -> customer-postbox-workload-helm
# global.fullnameOverride: "customer-postbox"
helm install customer-postbox kloudease/workload-helm -f values.yaml
# name -> customer-postbox
Global Labels and Annotations#
Apply labels or annotations to every resource the chart creates:
global:
labels:
team: platform
environment: production
annotations:
company.io/managed-by: helm
These are merged with any resource-specific labels/annotations.
Annotations are ususally used for configuration, for example an annotation on an ingress may specify if a SSL certificate should be created.
Labels are used to group respurces together, e.g. a team=frontend label may be assigned to all resources belonging to the frontend team.
Health Probes#
The chart enables liveness, readiness, and startup probes by default. Without any configuration, they all use a TCP socket check on the primary service port.
If your application exposes an HTTP health endpoint (e.g. /healthz or /health), override the probes to get meaningful health-check results:
probes:
liveness:
custom: true
spec:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 1
readiness:
custom: true
spec:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 5
periodSeconds: 10
failureThreshold: 3
timeoutSeconds: 1
startup:
custom: true
spec:
httpGet:
path: /healthz
port: 8080
periodSeconds: 5
failureThreshold: 30 # Up to 150 s (5 s × 30) before the pod is killed
timeoutSeconds: 1
Setting custom: true passes your spec block directly to Kubernetes, giving you access to the full probe API (httpGet, grpc, exec, etc.). For more detail, see Observability & Scaling.
What's Next#
Your app is running but it's only reachable inside the cluster. Continue to Services & Networking to expose it via Ingress.