A curated set of small, focused Kubernetes example manifests and notes intended for learning and experimentation.
Each directory contains one or more minimal manifests that demonstrate a single Kubernetes concept. The repo is intentionally small and explicit so you can apply, inspect, and iterate on each example easily.
How to use
- Review the YAML in a directory to understand the example.
- Apply it with kubectl (prefer a disposable namespace or a local cluster like kind/minikube):
# create a namespace for experiments
kubectl create ns k8s-samples-explore
# apply a sample (example: deployments)
kubectl apply -f 015-deployments/my-deployment.yml -n k8s-samples-explore
# view resources
kubectl get all -n k8s-samples-explore
# cleanup
kubectl delete -f 015-deployments/my-deployment.yml -n k8s-samples-explore
kubectl delete ns k8s-samples-exploreGeneral learning approach
- Apply one example at a time.
- Inspect resource status with
kubectl describeandkubectl logs. - Make small edits (image, resource limits, probes) and re-apply to observe behavior.
Directory index and purpose
-
000-kubeadm.md— Notes about using kubeadm to bootstrap a Kubernetes cluster. Useful if you're practicing cluster setup. -
005-configmaps/— Examples showing ConfigMap usage:sample-configmap.yml— create a ConfigMap from literal values.config-volume.yamlandconfigmap-volume-reader.yml— mount a ConfigMap as a volume and read it from a pod.readconfigmap-pod.yml— environment and volume examples for reading ConfigMap data.
-
006-secrets/— Secrets usage examples:my-secret.yml— create a kubernetes Secret.readsecret-pod.ymlandsecrets-volume-reader.yml— consume secrets as environment variables and mounted files.
-
007-resource-requests/— Demonstrates resource requests/limits:pod-with-resources.yml,http-pod-with-resources.yml,big-request-pod.yml— try scheduling and behavior when resources are constrained.
-
008-probes/— Probes (liveness/readiness/startup):liveness-pod.yml,liveness-pod-http.yml,readiness-pod.yml,startup-pod.yml— experiment with container health checks and how probe failures affect pod lifecycle.
-
009-restart-policies/— Pod restartPolicy variations:always-pod.yml,onfailure-pod.yml,never-pod.yml— understand restart behaviors for containers that exit.
-
010-multi-container-pods/— Multi-container pod patterns:multi-container-pod.yml— side-by-side containerssidecar-pod.yml— sidecar pattern for logging/auxiliary tasks.
-
011-init-containers/— Init container example (init-pod.yml) to run setup tasks before the main container. -
012-secheduling/— Scheduling primitives:nodeselector-pod.yml,nodename-pod.yml— node selection and direct node assignment examples.
-
013-daemonsets/— DaemonSet examples (test-daemonset.yml,cleaner.yml) for running pods on each node. -
014-staticpod/— Example static pod manifest (static-pod.yml) used when placing manifests on the node's kubelet-managed folder. -
015-deployments/— Deployment example (my-deployment.yml) demonstrating rolling updates and replica management. -
016-dns/— DNS troubleshooting example (dnstest.yml) to validate cluster DNS behavior. -
017-network-policies/— NetworkPolicy examples to allow/deny traffic:my-networkpolicy.yml,my-networkpolicy-allow.yml,network-deny-all.yml,np-nginx.yml,np-busybox.ymlmore/contains additional examples for namespace- and pod-selector-based rules and test pods.
-
018-services/— Service types and examples:svc-clusterip.yml,svc-nodeport.yml,deployment-service-example.yml,pod-service-test.yml,web.yml— ClusterIP, NodePort and wiring a Service to a Deployment/Pod.
-
019-ingress/— Sample Ingress manifest (ingress-sample.yml) showing basic host/path routing (requires an Ingress controller to be present). -
020-storage-volumes/— Storage examples:sample-pv.yml,sample-pv-pod.yml,sample-pvc.yml— PV/PVC basics.shared-volume-pod.yml,volume-pod.yml,localdisk-storageclass.yml— volume mounts and local storage class sample.
-
021-cornjobs/— CronJob sample (sample-cron.yml) showing scheduled jobs in Kubernetes. -
022-crds/— CustomResourceDefinition examples (crd.yml) and a sample CustomType (my-ct.yml) to show extending the Kubernetes API. -
023-security-context/— SecurityContext example (sc-ctx.yaml) demonstrating running pods with specific user/group or privilege restrictions. -
024-csr/— Placeholder/TODO for CertificateSigningRequest examples. -
025-kustomize/— Kustomize base example (inbase/) demonstrating Kustomize overlays and simple resource composition. -
026-taints-tolerations/— Taints and tolerations examples and notes (taint.md,affinity.md) plus sample pod YAMLs demonstrating scheduling under taints. -
027-image-pull-policy/— Examples showingimagePullPolicybehaviors (pod-1.yaml,pod-2.yaml). -
misc/— Miscellaneous examples and playground YAMLs for topics like PodSecurity, liveness probes, replicasets, deployments with configmaps/env, and more. Useful as ad-hoc examples.
Helpful tips
- Use a disposable cluster (kind/minikube/k3d) so you can freely apply and delete examples.
- Use
kubectl explain <resource>andkubectl get <resource> -o yamlto inspect live resources. - When experimenting with networking or storage, make sure your cluster environment supports those features (CNI plugin for NetworkPolicy, storage class for PVCs, Ingress controller for Ingress resources).
Contributing
- If you add new examples, give them a focused purpose and include a short README inside the folder explaining the learning objective and any prerequisites.
License and attribution
- This repo is intended for learning — adapt and reuse examples as needed.
This repository is licensed under the MIT License — see the LICENSE file for details.