What Is Kubernetes?#
Kubernetes, also known as K8s, is an open-source system for automating deployment, scaling, and management of containerized applications.
– The Kubernetes team
Kubernetes orchestrates and manages collections of containers (often using container runtimes like containerd). It takes care of scaling, distribution, and connectivity among these containers. Think of it as a system to manage many containers and the infrastructure they run on.
For example, you could install Docker on a single server, and route traffic directly to it. That’s fairly simple to set up, but what if you want 10 instances of that server? What about 1000 instances? What if you want to deploy many different services, each scaling up with more instances depending on load? Those are the problems that Kubernetes solves.
Kubernetes is the container orchestration platform. Nearly every modern DevOps workflow runs on top of it in production. I use Kubernetes to:
- Orchestrate containers across single-node (Minikube) and multi-node aws(WORK IN PROGRESS) clusters
- Declare the desired state with YAML manifests and let controllers reconcile it
- Load balance and expose services through Services, Ingress and Gateways
- Control who can do what with RBAC
- Scale workloads vertically and horizontally (HPA)
- Persist state with volumes, PVCs and persistent storage
- Run stateful workloads like databases with StatefulSets
- Run batch work and scheduled tasks with Jobs and CronJobs
- And much more
Kubernetes konular (Konuları sırayla takip ederseniz, verdiğim görevlerin birbiriyle bağlantılı olduğunu ve sistemin pratikte nasıl çalıştığını daha net görebilirsiniz.)#
- kubernetes-minikube
- kubernetes-pods-minikube
- kubernetes-deployments-minikube
- kubernetes-probes
- kubernetes-deployment-rollouts
- kubernetes-yaml-configurations
- kubernetes-secrets
- kubernetes-rbac
- kubernetes-jobs-cronjobs
- kubernetes-services
- kubernetes-ingress
- kubernetes-gateway-minikube
- kubernetes-namespaces
- kubernetes-dns-coredns
- kubernetes-scaling-vertical
- kubernetes-scaling-horizontal
- kubernetes-storage
- kubernetes-persistent-volumes
- kubernetes-storage-classes
- kubernetes-statefulsets
- kubernetes-nodes-basic
Temeller#
- kubernetes-minikube = Minikube ile local cluster,
kubectl create deployment,port-forward, Prod vs Minikube farkı - kubernetes-pods-minikube = Pod kavramı, ephemeral doğası,
kubectl logs/delete pod, pod’ların unique IP adresleri - kubernetes-deployments-minikube = Deployment ve ReplicaSet, desired vs current state,
kubectl get/edit deployment - kubernetes-probes = Liveness/Readiness/Startup probes,
httpGet/tcpSocket/exec, rolling update’lerde probes’un rolü - kubernetes-deployment-rollouts = Rolling update (
maxSurge/maxUnavailable),kubectl set image,rollout status/history/undo, bozuk imajdan kurtarma - kubernetes-yaml-configurations = YAML manifest yapısı (
apiVersion,kind,spec), ConfigMap,env/envFrom, Secrets
Secret’lar, RBAC ve Batch İşleri#
- kubernetes-secrets =
kubectl create secret,secretKeyRef/envFrom/volume mount, base64 ≠ şifreleme, Sealed Secrets/External Secrets - kubernetes-rbac = ServiceAccount (token mount), Role/ClusterRole, RoleBinding/ClusterRoleBinding,
kubectl auth can-i --as - kubernetes-jobs-cronjobs = Job (
completions/parallelism/backoffLimit), CronJob (schedule/concurrencyPolicy), db.json yedekleme pipeline’ı
Ağ (Services, Ingress, Gateway & TLS)#
- kubernetes-services =
ClusterIP,NodePort,LoadBalancer,ExternalName, stable endpoint ve load balancing - kubernetes-ingress = Ingress controller (nginx) vs Ingress resource, host/path kuralları,
ingressClassName, TLS + Secret - kubernetes-gateway-minikube = Gateway API (Envoy),
HTTPRoute,/etc/hosts+minikube tunnel, annotations - kubernetes-namespaces =
kubectl create ns,-nflag, intra-cluster DNS (svc.cluster.local) - kubernetes-dns-coredns = CoreDNS + Corefile ConfigMap,
dnsPolicy/ndots,nslookupile DNS troubleshooting, kube-dns servisi
Ölçeklendirme#
- kubernetes-scaling-vertical =
metrics-server,kubectl top(pod + node), resource limits (50mCPU,256MiRAM), CrashLoopBackOff - kubernetes-scaling-horizontal =
HorizontalPodAutoscaler(HPA),minReplicas/maxReplicas, CPU hedefli otomatik ölçekleme
Depolama#
- kubernetes-storage = Ephemeral filesystem,
emptyDirvolumes, multi-container pod’lar (sidecar), veritabanları - kubernetes-persistent-volumes =
PersistentVolume(PV),PersistentVolumeClaim(PVC), dynamic provisioning, volumeMounts - kubernetes-storage-classes = StorageClass (
provisioner/volumeBindingMode/allowVolumeExpansion), access modes (RWO/ROX/RWX),reclaimPolicyRetain/Delete, static PV - kubernetes-statefulsets = Stable identity,
volumeClaimTemplatesile pod başına PVC, headless services, PostgreSQL örneği
Prod’e Geçiş#
- kubernetes-nodes-basic = Control plane ve worker node’lar, GKE/EKS/AKS, resource requests vs limits