Kubernetes basics

Package management and everyday tools

Helm and Rancher Catalog, Kustomize, and pod logging and debugging with kubectl tools.

5 min read

Package management and everyday tools

In this section you will learn to manage applications at a higher level with Helm and from the Rancher Apps/Catalog view, to modify ready-made manifests with Kustomize, and to use everyday tools for logging and debugging pods. At the end you will install a ready-made application with a Helm chart and override its values.


1. Why is package management needed?

Deploying a single application can mean dozens of YAML manifests (Deployment, Service, Ingress, ConfigMap, Secret…). Maintaining them by hand is laborious and error-prone.

Package management solves this:

  • it bundles all of an application’s resources into a single package,
  • it enables versioning, parameterization, and reuse,
  • it makes installation, upgrades, and removal repeatable.

In Kubernetes the most common solution is Helm.


2. Helm package management

Helm is Kubernetes’ package manager. The key concepts:

  • Chart – a package that contains the application’s manifests as templates and the default values (values.yaml).
  • Release – an instance of a chart installed into the cluster (you can install the same chart many times under different names).
  • Repository – a collection of charts from which they are downloaded.
  • Values – the parameters with which a chart’s default values are overridden.
flowchart LR
    REPO[Helm repository] --> CHART[Chart + values.yaml]
    VALUES[Custom values] --> CHART
    CHART -->|helm install| REL[Release]
    REL --> K8S[Kubernetes objects:<br/>Deployment, Service, ...]

The structure of a chart in a nutshell:

text
mychart/
├── Chart.yaml        # chartin metatiedot (nimi, versio)
├── values.yaml       # oletusarvot
└── templates/        # manifestimallit (käyttävät arvoja)

The most common commands:

bash
# Lisää ja päivitä repository
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

# Asenna, päivitä, listaa, poista
helm install web bitnami/nginx
helm upgrade web bitnami/nginx --set replicaCount=3
helm list
helm uninstall web

# Peruuta edelliseen versioon
helm rollback web 1

3. Rancher Catalog and Apps

Rancher offers Helm charts graphically in the Apps view (formerly Catalog):

  • Apps → Charts – installable applications from pre-configured repositories.
  • Apps → Repositories – adding your own Helm repositories.
  • During installation, Rancher shows the chart’s values as a form or a YAML editor, so you can override them without the command line.

Under the hood, Rancher uses the same Helm — an application installed from the Apps view also appears with the command helm list.


4. Kustomize

Kustomize is a template-free way to modify ready-made manifests. It is built into the kubectl tool (kubectl apply -k).

  • base – the shared base manifests.
  • overlays – environment-specific changes (e.g. dev, prod) that patch the base.
  • Everything is assembled with a kustomization.yaml file.
text
base/
├── deployment.yaml
├── service.yaml
└── kustomization.yaml
overlays/
└── prod/
    └── kustomization.yaml   # viittaa baseen ja tekee muutokset
bash
# Rakenna ja ota käyttöön overlay
kubectl apply -k overlays/prod

Helm vs. Kustomize: Helm parameterizes with templates and values; Kustomize modifies existing manifests by patching. You can also use both together.


5. Everyday tools: logging and debugging

When an application does not work as expected, these kubectl commands help you find the cause:

bash
# Podin lokit (seuraa reaaliaikaisesti -f, edellinen käynnistys --previous)
kubectl logs <pod>
kubectl logs -f <pod>
kubectl logs --previous <pod>
kubectl logs -l app=web        # kaikki labelia vastaavat podit

# Podin tila, tapahtumat ja määrittelyt
kubectl describe pod <pod>

# Aja komento podin sisällä (interaktiivinen shell)
kubectl exec -it <pod> -- sh

# Klusterin tapahtumat (viimeisimmät ongelmat)
kubectl get events --sort-by=.lastTimestamp

# Resurssien käyttö (vaatii metrics-serverin)
kubectl top pods
  • kubectl logs – the application’s output; the first place to look when troubleshooting.
  • kubectl describe – shows the events (Events), e.g. why a Pod does not start.
  • kubectl exec – lets you get inside the pod to test networking, files, or processes.

6. Hands-on: installing an application with Helm and overriding values

Install a ready-made application with a Helm chart, override its values, and inspect the result with the logging and debugging tools. First make sure you have the cluster’s kubeconfig in use (see the exercise in the architecture section) and access to Rancher.

1. Create and switch to your own namespace:

bash
# Korvaa <oma-nimi> omalla nimelläsi
kubectl create namespace <oma-nimi> --dry-run=client -o yaml | kubectl apply -f -
kubectl config set-context --current --namespace=<oma-nimi>

A) Installation from the Rancher Apps view

  1. In Rancher, open Apps → Charts.
  2. Find the application (e.g. Metrics Server or Nginx) and select Install.
  3. Choose your own namespace (<oma-nimi>) as the target namespace.
  4. Override the values from the form or the Edit YAML view (e.g. replicaCount: 2).
  5. Complete the installation and follow the status in the Installed Apps view.

B) Installation from the command line with Helm

bash
# Lisää chart-repository
helm repo add bitnami https://charts.bitnami.com/bitnami
helm repo update

# Asenna nginx omaan nimiavaruuteen ja ylikirjoita arvoja
helm install web bitnami/nginx \
  --namespace <oma-nimi> \
  --set replicaCount=2 \
  --set service.type=ClusterIP

# Listaa releaset ja tarkista Podit
helm list --namespace <oma-nimi>
kubectl get pods

Alternatively, override the values with a values file:

bash
cat <<'EOF' > values.yaml
replicaCount: 2
service:
  type: ClusterIP
EOF

helm upgrade --install web bitnami/nginx --namespace <oma-nimi> -f values.yaml

C) Inspect and debug the installed application

bash
# Lokit
kubectl logs -l app.kubernetes.io/name=nginx

# Yhden podin tarkat tiedot ja tapahtumat
kubectl describe pod <pod>

# Aja komento podin sisällä
kubectl exec -it <pod> -- sh

🔎 Observation: An application installed from Rancher and one installed from the command line with Helm are the same Release. You can manage it either way — the same Helm is underneath.

4. Clean up the exercise by removing the release and your namespace:

bash
helm uninstall web --namespace <oma-nimi>
kubectl delete namespace <oma-nimi>

Summary

  • Helm bundles an application’s resources into a chart; the installed instance is a Release, whose values can be overridden (--set or a values file).
  • Rancher Apps/Catalog offers the same Helm charts graphically — Helm is underneath.
  • Kustomize modifies ready-made manifests by patching (kubectl apply -k); no templates.
  • Everyday troubleshooting: kubectl logs (logs), kubectl describe (events), and kubectl exec (inside the pod).