
Kubernetes, part 6: monitoring, logs, GitOps with Argo CD, and managed Kubernetes in Kazakhstan's cloud
🌐 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.storageSpecwith PVC on Longhorn, shelf liferetention(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.
💡 In k3s, control plane components operate within a single process, so some standard rules ("KubeSchedulerDown", "KubeControllerManagerDown", etc.) out of the box give false alarms. Disable them in values or configure metric collection according to the k3s documentation.
Prometheus collects metrics of its application through the ServiceMonitor object:
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: podinfo
namespace: demo
labels:
release: kps # по этой метке Prometheus из чарта находит ServiceMonitor
spec:
selector:
matchLabels:
app: podinfo # метка Service — добавьте ее в metadata.labels сервиса из части 3
endpoints:
- port: http
path: /metrics
If the company already has Zabbix or a separate Prometheus with Grafana — link them: external Grafana can read the cluster's Prometheus, and alerts go to the same Telegram. How the unified monitoring system works — the "Monitoring: Zabbix, Prometheus, and Grafana" series.
What must be monitored in the cluster#
- nodes:
NotReady, memory, disk (especially/var/lib/rancherand Longhorn disks); - Pods in
CrashLoopBackOff, frequent restarts,OOMKilled; - Deployment, which has fewer ready-made replicas than desired;
- certificate validity period (cert-manager returns metrics);
- health etcd and snapshots, status of Longhorn volumes;
- external application availability — blackbox verification over HTTPS.
Logs: Loki and Grafana Alloy#
kubectl logs good for debugging, but logs disappear along with the pod. For centralized logs, a typical bundle is Loki (log storage) + Grafana Alloy (collector on each node) + Grafana for searching.
Important as of November 2026:
- Promtail, which was previously installed as a Loki assembler, ended support on March 2, 2026. For new installations, use Grafana Alloy; old Promtail configurations are converted by the
alloy convert --source-format=promtailcommand. - The open Loki Helm chart moved to a separate community repository in 2026. Check the current chart address and recommended installation mode (for small clusters — monolithic / single binary) in the Loki documentation.
Log storage objects in Loki are conveniently placed in S3-compatible storage. If the logs contain personal data, consider where the storage is physically located.
GitOps: Argo CD#
GitOps — the cluster resets itself to the state described in Git. Instead of kubectl apply from the administrator's laptop: changing → merge request → review → Argo CD applies. Change history, rollback, and "who changed what" — free, from Git.
Installation (fixed version, current as of November 2026 — v3.6.1):
kubectl create namespace argocd
kubectl apply -n argocd --server-side --force-conflicts \
-f https://raw.githubusercontent.com/argoproj/argo-cd/v3.6.1/manifests/install.yaml
kubectl -n argocd get pods
--server-side needed because the Argo CD CRD part is too large for a regular kubectl apply. Check the latest version on the releases page.
First entry:
kubectl -n argocd port-forward svc/argocd-server 8080:443
# в другом окне — начальный пароль пользователя admin
kubectl -n argocd get secret argocd-initial-admin-secret -o jsonpath='{.data.password}' | base64 -d; echo
Open https://localhost:8080, log in as admin, change the password , and delete the argocd-initial-admin-secretsecret. For the team, connect the login via corporate SSO (OIDC) and issue privileges via RBAC Argo CD.
An application from the directory k8s/ your repository (part 3):
apiVersion: argoproj.io/v1alpha1
kind: Application
metadata:
name: podinfo
namespace: argocd
spec:
project: default
source:
repoURL: https://github.com/ваша-организация/infra.git
targetRevision: main
path: k8s
destination:
server: https://kubernetes.default.svc
namespace: demo
syncPolicy:
automated:
prune: true
selfHeal: true
syncOptions:
- CreateNamespace=true
selfHeal: true— manual edits in the cluster will roll back to Git;prune: true— deleted from Git is removed from the cluster.
A link to CI from the "Docker and CI/CD from scratch" series: CI collects an image with a commit tag and changes the tag in the manifest (or values) in the infrastructure repository, Argo CD sees the change and checks it out. CI no longer needs cluster access — it's noticeably more secure.
An alternative to Argo CD is Flux: the same approach, without the default web interface.
Safety — minimum#
- RBAC: personal accounts (via OIDC), namespace rights,
cluster-adminto individuals. - Pod Security Admission: the
pod-security.kubernetes.io/enforce: restricted(orbaseline) label on the application namespace prohibits privileged containers. - NetworkPolicy: by default, all pods see each other; restrict database access to only the necessary applications (K3s supports NetworkPolicy).
- Images — from trusted registries, with specific tags, vulnerability scanning in CI.
- API server (6443), Argo CD, and Grafana — not internet access unless necessary; access via VPN.
- More about protection practices — the series "Information Security and Anti-Fraud."
Your own cluster or managed Kubernetes#
Managed Kubernetes — the provider maintains control plane (etcd, API, updates), you handle workstations and applications. Such services are available to large foreign clouds and some cloud providers in Kazakhstan; availability, versions, and terms change, so we do not provide names here — check the providers' websites.
| Your k3s on VM | Managed Kubernetes | |
|---|---|---|
| Control plane | your concern: etcd, updates, certificates, | serviced by the |
| Balancers, disks | MetalLB, Longhorn — configure them yourself | usually integrated (LoadBalancer, StorageClass provider) |
| Cost | hardware or VM + admin time | nodes + frequent fees for control plane, balancers, traffic — check with the provider |
| Kubernetes versions | any versions, update when | from the provider list are ready; old versions are forcibly updated |
| Data | where your servers | in the provider's data center |
Questions for the provider before choosing:
- Where are the nodes, disks, backups, and logs physically located? If the system contains personal data of citizens of the Republic of Kazakhstan, it must be stored within the territory of Kazakhstan.
- Which versions of Kubernetes are available and how quickly do new ones appear? How does the update work?
- Is there an SLA on the control plane and what does it include? Is it possible to create nodes in multiple zones?
- What types of disks (StorageClass), are there
ReadWriteMany, snapshots, or backup volumes? - How are balancers, incoming and outgoing traffic structured, and how much do they cost?
- Is there an image registry, S3-compatible storage, integration with IAM/SSO?
- Is it possible to get full access to the API (
cluster-admin) and install your own operators and CRDs?
A general checklist for choosing a cloud and moving is in the series "Clouds in Kazakhstan."
💡 Good news: if you've been going through a series and keep everything in Git (manifests, values, Argo CD), moving between your cluster and the managed one is basically switching StorageClass, Ingress/Balancer, and data transfer.
Summary: The Series Path#
| Stage | What can you do | Resources |
|---|---|---|
| Basics | understand when Kubernetes is needed, install k3s, use kubectl | 1 VM |
| Applications | Deployment, Service, Ingress, ConfigMap, Secret, volumes, Helm, database operator, | 1 VM |
| Cluster | 3 servers + agents, etcd, Longhorn, HTTPS, updates without downtime | 5 VMs on 2–3 hosts |
| Operation | monitoring, logs, GitOps, security, cloud | selection + storage for metrics and logs |
Production cluster checklist#
- Supported version of Kubernetes, the same on all nodes, upgrade plan
- 3 servers on different physical hosts, permanent API address
- Snapshots etcd outside the cluster, token in password manager, recovery check
- Replicable storage or external storage; backup of volumes and databases by their means
- Ingress or Gateway API with TLS from cert-manager; ingress-nginx is not used
- Applications: specific image tags, requests/limits, probes, 2+ replicas, PodDisruptionBudget
- Secrets do not lie in Git in plaintext
- RBAC with personal accounts, Pod Security, NetworkPolicy
- Monitoring, alerts, and centralized logs
- All manifests and values in Git, deployed via Argo CD or Flux
🎉 Series completed. Return to contents.
Comments · 0
No comments yet.Sign in to comment, rate and see all comments.