
🌐 Machine-translated from Russian. Show original
In this part:
Monitoring: kube-prometheus-stack
The standard set for Kubernetes is the kube-prometheus-stack chart: Prometheus Operator, Prometheus, Alertmanager, Grafana, node-exporter, kube-state-metrics, and ready-made dashboards and alert rules for the cluster.
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo update
helm show values prometheus-community/kube-prometheus-stack > kps-values.yaml
helm install kps prometheus-community/kube-prometheus-stack \
-n monitoring --create-namespace -f kps-values.yaml
kubectl -n monitoring get pods
In kps-values.yaml before installation, it is worth replaced:
- administrator password Grafana (
grafana.adminPassword) — preferably through an existing Secret;
- Prometheus storage:
prometheus.prometheusSpec.storageSpec with PVC on Longhorn, shelf life retention (e.g., 15d);
- Ingress for Grafana with TLS via cert-manager from part 5.
Temporary access to Grafana: kubectl -n monitoring port-forward svc/kps-grafana 3000:80.
Read more
🌐 Machine-translated from Russian. Show original
In this part:
Cluster diagram
| Node | Role | IP |
|---|
| K8S-S1, K8S-S2, K8S-S3 | Server: Control Plane + etcd (can also run applications) | 192.168.1.41–43 |
| K8S-A1, K8S-A2 | Agent: only applications | 192.168.1.51–52 |
k8s-api.corp.local | a permanent API address | a virtual IP or a |
Why three servers: etcd stores the cluster state and requires quorum — most nodes. Of three, one may fail, of two — none (two are worse than one). The number of servers is always odd.
Requirements for each node: Ubuntu 24.04, unique name, synchronized time (timedatectl), network with low server latency. A fast SSD is needed for etcd — on slow disks, the cluster is unstable.
Servers are conveniently maintained as virtual machines on different physical hosts — otherwise, failure of one hypervisor will drop the quorum. How to prepare VMs — the "Linux server and KVM" series.
Ports between nodes
Read more
🌐 Machine-translated from Russian. Show original
In this part:
How Kubernetes works with disks
| Object | What is this |
|---|
| StorageClass | the "type" of storage and who creates it: local disk, NFS, Longhorn, Ceph, cloud disk, |
| PersistentVolumeClaim (PVC) | application request: "needs 10 GB, ReadWriteOnce" |
| PersistentVolume (PV) | a specific volume created for a |
The application requests PVC, not a specific drive — so the same manifest works both in k3s and in the cloud.
| Access mode | Means |
|---|
ReadWriteOnce (RWO) | volume connects to a single node — the database, most applications |
ReadWriteMany (RWX) | simultaneously from multiple nodes — shared files; NFS, CephFS, or Longhorn with RWX |
local-path in k3s
By default, k3s has StorageClass local-path: volume is the directory in /var/lib/rancher/k3s/storage on the node where pod is running.
kubectl get storageclass
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: data
namespace: demo
spec:
accessModes: [ReadWriteOnce]
storageClassName: local-path
resources:
requests:
storage: 5Gi
Connection in Deployment:
Read more
🌐 Machine-translated from Russian. Show original
In this part:
What we are unfolding
The small web service podinfo is an open demo application created specifically for Kubernetes training: web pages, health checks /healthz and /readyz, configuration through variable environments. Instead, substitute your image from the Docker series — the manifest structure will be the same.
Keep all manifests in Git in the k8s/ directory — in part 6 it will become the source for automatic deployment.
Step 1. Namespace
The namespace separates applications from each other: their own objects, rights, quotas.
# k8s/00-namespace.yaml
apiVersion: v1
kind: Namespace
metadata:
name: demo
Step 2. ConfigMap and Secret
# k8s/10-config.yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: podinfo-config
namespace: demo
data:
PODINFO_UI_MESSAGE: "Привет от Kommit!"
PODINFO_UI_COLOR: "#326ce5"
Do not keep the secret in Git plaintext — create it as a command (in a real application, there will be a database password or API key):
kubectl create secret generic podinfo-secret -n demo \
--from-literal=DB_PASSWORD="$(openssl rand -base64 24)"
Read more
🌐 Machine-translated from Russian. Show original
In this part:
Step 1. Server preparation
Ubuntu Server 24.04 with static IP (examples — 192.168.1.40, k3s01name), updates, and SSH key login. The server name must be unique — it will become the node name.
sudo apt update && sudo apt full-upgrade -y
sudo hostnamectl set-hostname k3s01
If Docker is already running on the server, it's better to use a pure VM: k3s uses its own containerd, and two container engines on one machine only confuse.
Step 2. Firewall
The k3s documentation recommends disabling ufw. If you leave it enabled (this is reasonable for a server accessible from other networks), allow APIs, pod and service networks, and HTTP(S):
sudo ufw allow from 192.168.1.0/24 to any port 6443 proto tcp # API Kubernetes — только из своей сети
sudo ufw allow from 10.42.0.0/16 to any # сеть подов k3s по умолчанию
sudo ufw allow from 10.43.0.0/16 to any # сеть сервисов k3s по умолчанию
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
Step 3. Installing k3s
curl -sfL https://get.k3s.io | sh -s - --write-kubeconfig-mode 600
Read more
🌐 Machine-translated from Russian. Show original
In this part:
In simple terms
- A container is an application with all dependencies, packaged in an image. You already know this from Docker.
- Docker Compose — describes multiple containers on one server in a single YAML file.
- Kubernetes (k8s) is an "operating system for a group of servers": you describe what should work ("3 copies of the application available at app.example.kz address"), and Kubernetes decides where to start containers, restarts the downed ones, moves them from the failed server, and updates without downtime.
The key idea is declarativeness: you store the desired state in YAML, and Kubernetes constantly brings reality to it.
How a cluster is structured
| Part | What does |
|---|
| Control plane | API server, scheduler, controllers, state store**, etc** |
| Worker nodes | run containers: kubelet, container runtime environment, network proxy, |
| kubectl | console client: all commands go through the |
| CNI | network between pods at different nodes |
| CSI | connecting disks and storage |
| Ingress / Gateway | HTTP(S) traffic input from outside |
Docker Compose or Kubernetes
Read more