Saturday, June 28, 2025

Helm chart values

 Need to know all the values for a given helm chart and the readme and other documentation is not up-to-date?


The best thing to do is run the show values command and save it off to a file like below


helm show values prometheus-community/kube-prometheus-stack  > values.yaml


Now you can peruse the values.yaml file and find all the values you want to set.

Tuesday, June 17, 2025

K3s

 Finally setup my homelab which is working great and the first thing I did is install k3s.  Wow, super simple.  See commands below.  

curl -sfL https://get.k3s.io | INSTALL_K3S_EXEC="--disable=helm-controller" sh -

Note K3s was created by Rancher.

https://k3s.io/

https://www.digitalocean.com/community/tutorials/how-to-setup-k3s-kubernetes-cluster-on-ubuntu

The only tweak I did was to disable the helm controller because I want to use Flux.  Flux has a helm controller built into it.

From the Flux installation logs we can see Helm controller was installed

► confirming components are healthy

✔ helm-controller: deployment ready


Thursday, June 5, 2025

Kubernetes Deployments and ReplicaSets

In this post I'll explain how deployments and replicasets work together.

When a deployment is created with the command below

k  create deployment test --image=httpd --replicas=10

The deployment creates a replicaset and the replicaset manages the pods and makes sure the specified number of pods are running.

To see the number of pods running 

k describe replicasets.apps test-6546ccdcf9

This is a partial result from the command above.

Replicas:       10 current / 10 desired

You can have many replicasets for a given deployment.  One should not create a replicaset directly but use a deployment to do that.  Here is what the kubernetes docs says about this.

https://kubernetes.io/docs/concepts/workloads/controllers/replicaset/


A ReplicaSet ensures that a specified number of pod replicas are running at any given time. However, a Deployment is a higher-level concept that manages ReplicaSets and provides declarative updates to Pods along with a lot of other useful features. Therefore, we recommend using Deployments instead of directly using ReplicaSets, unless you require custom update orchestration or don't require updates at all.

You can accumulate multiple replicasets by doing updates.  For example rolling updates and if you ever need to go back to a previous version you have the previous replicaset at your disposal.  

To see or change the default number of replicasets kept, which is 10 run the command below.

k get deployments.apps test --output=yaml

spec:
  replicas: 10
  revisionHistoryLimit: 10




Tuesday, June 3, 2025

kubernetes dry run to create a yaml file

If you need to create a yaml file from scratch for a nginx image a quick and easy way to do this is to run

k run nginx-yaml --image=nginx --dry-run=client --output=yaml

If you don't remember how to do this off the top of your head you can run a help command on dry run

k run -h | less

To save the yaml output to a file to run with an apply or create statement it would look like this.

k run nginx-yaml --image=nginx --dry-run=client --output=yaml > nginx.yaml

This is very fast and saves you from having to google or dig through the kubernetes docs.

Monday, June 2, 2025

CloudNativePG

A co-worker pointed me in the direction of using CloudNativePG to handle PostgreSQL backups on a Kubernetes cluster.  

CloudNativePG is a Kubernetes operator that can be installed and configured in a .yaml file to take care of your PostgreSQL backups.

An example of this would be having your database backup go to an S3 bucket.  Seems really cool and look forward to implementing this.

Kubernetes Service

 What is the point of a Service in Kubernetes Accessing a pod by name or IP directly is fragile and not recommended for long-term connectiv...