Skip to content
tezvyn:

All bites

The whole library, newest first. Filter by what you are here for, or pick a topic if you already know.

4330 bites

Page 39

Docker & Kubernetes1 min read

Topology spread constraints versus pod anti-affinity

Spread constraints balance pod counts per domain bounded by maxSkew, anti-affinity is all-or-nothing co-location avoidance, and maxSkew caps the difference between fullest and emptiest…

Docker & Kubernetes1 min read

Role versus ClusterRole in RBAC

Role is namespaced, ClusterRole is cluster-wide and covers cluster-scoped resources, and you grant either via a RoleBinding (namespaced) or ClusterRoleBinding (cluster-wide) to a subject.

Docker & Kubernetes1 min read

First NetworkPolicy flips a pod to default-deny

Once any policy selects a pod for a direction, that direction becomes default-deny and only explicitly allowed traffic passes; unselected pods stay open.

Docker & Kubernetes1 min read

Troubleshooting an RBAC forbidden error

Use kubectl auth can-i with --as impersonation to check the verb, inspect RoleBindings and ClusterRoleBindings, and read the role rules.

Docker & Kubernetes1 min read

Namespace-scoped RBAC for a ServiceAccount

Create a Role in production granting create on deployments (apps group) and services (core group), then a RoleBinding tying that Role to the ServiceAccount.

Docker & Kubernetes1 min read

Write a frontend-to-backend NetworkPolicy

Set podSelector to app=backend, policyTypes Ingress, one ingress rule with from podSelector app=frontend and ports TCP 8080; the implicit deny handles the rest.

Docker & Kubernetes1 min read

Root and NET_ADMIN under Pod Security Standards

Set runAsUser 0 and capabilities add NET_ADMIN in the container securityContext; this is rejected by Restricted and Baseline, so the namespace must use the Privileged profile.

Docker & Kubernetes1 min read

Binding a ClusterRole with a RoleBinding

A RoleBinding referencing a ClusterRole grants those rules only within the binding's namespace; reuse built-in roles like view per-team without duplicating definitions.

Docker & Kubernetes1 min read

Multi-tenant isolation with a monitoring exception

Apply default-deny ingress per tenant namespace, allow same-namespace traffic, then add an ingress rule permitting the monitoring namespace via namespaceSelector on the metrics port.

Docker & Kubernetes1 min read

Viewing pod logs and durable log collection

Kubectl logs (with -c, --previous, -f) reads container stdout/stderr; because that storage is ephemeral, run a node-level logging agent as a DaemonSet shipping logs to a central store.

Docker & Kubernetes1 min read

kube-state-metrics versus node-exporter

Kube-state-metrics exposes API object state (deployment replicas, pod phase, restarts) from the control plane, while node-exporter exposes OS-level hardware metrics (CPU, memory, disk) per…

Docker & Kubernetes1 min read

Auto-discovering app pods for Prometheus scraping

Use kubernetes_sd_configs with role pod, relabel on pod annotations like prometheus.io/scrape to filter, and set path and port; with the Operator use a PodMonitor or ServiceMonitor.

Docker & Kubernetes1 min read

EFK centralized logging architecture

Fluentd runs as a DaemonSet collecting node container logs, parses and forwards to Elasticsearch for indexed storage, and Kibana queries and visualizes them.

Docker & Kubernetes1 min read

PromQL for top 5 CPU-consuming pods

Apply rate() to the counter over 15m, sum by pod to combine containers, then wrap in topk(5); rate handles counter resets.

Docker & Kubernetes1 min read

Alerting on under-replicated Deployments

Write an alerting rule comparing kube_state_metrics available vs desired replicas with for: 5m, Prometheus evaluates and fires to Alertmanager, which dedupes/routes/notifies.

Docker & Kubernetes1 min read

What is distributed tracing in microservices?

A trace is a tree of spans tied by trace and span IDs, propagated via headers like W3C traceparent.

Docker & Kubernetes1 min read

Diagnose a Prometheus cardinality explosion

Find offenders via TSDB stats and topk count by __name__, identify unbounded labels, then drop or aggregate them with relabeling.

Docker & Kubernetes1 min read

Head-based vs tail-based trace sampling

Head decides up front (cheap, may miss rare errors); tail decides after the trace completes (catches errors and slow traces but needs buffering).

Docker & Kubernetes1 min read

What is a Helm chart?

A chart is a templated, versioned bundle of manifests with a values file; it solves config duplication and reuse across environments.

Docker & Kubernetes1 min read

What is the basic principle of GitOps?

Git holds desired state; a controller continuously reconciles the cluster to match it; benefits are auditability, rollback, and drift correction.