Skip to content

Bits of .NET

Daily micro-tips for C#, SQL, performance, and scalable backend engineering.

  • Asp.Net Core
  • C#
  • SQL
  • JavaScript
  • CSS
  • About
  • ErcanOPAK.com
  • No Access
  • Privacy Policy

Category: Kubernetes

Kubernetes

Kubernetes: Keeping Critical Pods Safe with Taints and Tolerations

- 28.02.26 - ErcanOPAK comment on Kubernetes: Keeping Critical Pods Safe with Taints and Tolerations

In a large cluster, you don’t want ‘general’ workloads running on your expensive GPU nodes or high-security master nodes. The Logic: – Taint: Applied to a Node (“Only special pods allowed here”). – Toleration: Applied to a Pod (“I am allowed to run on that special node”). This is the foundation of multi-tenant cluster management […]

Read More
Kubernetes

Kubernetes: The Critical Difference Between Liveness and Readiness Probes

- 28.02.26 - ErcanOPAK comment on Kubernetes: The Critical Difference Between Liveness and Readiness Probes

Misconfiguring these two can cause your app to go into a restart loop or serve 500 errors to users. Readiness Probe: Tells K8s when the app is ready to receive traffic (e.g., after DB migrations). Liveness Probe: Tells K8s if the app is alive. If this fails, K8s kills and restarts the container. Pro Tip: […]

Read More
Kubernetes

Kubernetes: Avoiding the ‘OOMKilled’ Error with Proper Resource Limits

- 28.02.26 - ErcanOPAK comment on Kubernetes: Avoiding the ‘OOMKilled’ Error with Proper Resource Limits

One of the most common K8s failures is the Out of Memory (OOM) Killer. This happens when your container exceeds its allocated limit. Type Definition Requests What the pod is guaranteed to have. Limits The absolute maximum the pod can consume. Pro Strategy: Always set requests equal to limits for memory to avoid unstable rescheduling […]

Read More
Kubernetes

Kubernetes Monitoring: The Prometheus + Grafana Stack That Saved Our Production

- 23.02.26 - ErcanOPAK comment on Kubernetes Monitoring: The Prometheus + Grafana Stack That Saved Our Production

🚨 The 3 AM Wake-Up Call Your Kubernetes cluster is down. Users are angry. You have no idea what happened. This is why Fortune 500 companies spend $500K/year on observability. The Complete Observability Stack 📊 The Three Pillars Metrics – What’s happening right now (Prometheus) Logs – What happened in the past (Loki) Traces – […]

Read More
Kubernetes

Kubernetes: Use Kustomize for Environment-Specific Configurations

- 22.02.26 - ErcanOPAK comment on Kubernetes: Use Kustomize for Environment-Specific Configurations

Maintaining separate YAML files for dev/staging/prod is messy. Kustomize manages variations without duplication. Base Configuration: # base/deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: name: myapp spec: replicas: 2 template: spec: containers: – name: app image: myapp:latest Production Override: # overlays/production/kustomization.yaml resources: – ../../base patchesStrategicMerge: – replicas.yaml # Sets replicas: 10 – image.yaml # Sets image: myapp:1.5.3 […]

Read More
Kubernetes

Kubernetes: Implementing a GitOps Workflow with ArgoCD

- 21.02.26 | 22.02.26 - ErcanOPAK comment on Kubernetes: Implementing a GitOps Workflow with ArgoCD

In a professional DevOps environment, the Git repository is the Single Source of Truth. Manual kubectl apply commands are replaced by ArgoCD. Git Push → CI Build → Manifest Update → ArgoCD Sync → K8s Cluster This ensures that your cluster state always matches your code, enabling instant rollbacks and better security audits.

Read More
Kubernetes

Kubernetes: Advanced Node Scheduling with Taints and Tolerations

- 21.02.26 - ErcanOPAK comment on Kubernetes: Advanced Node Scheduling with Taints and Tolerations

In a production cluster, you often want to keep ‘special’ nodes (like GPU-powered ones) only for specific pods. Concept: • Taint: The Node says “I only allow special pods.” • Toleration: The Pod says “I am allowed on that special node.” # Add taint to node kubectl taint nodes node1 key1=value1:NoSchedule

Read More
Kubernetes

Kubernetes: Namespace Resource Quotas to Prevent Cost Spikes

- 21.02.26 - ErcanOPAK comment on Kubernetes: Namespace Resource Quotas to Prevent Cost Spikes

In a multi-tenant cluster, one runaway pod can consume all resources and crash other services. The Solution: Define a ResourceQuota per namespace. This limits the total CPU and Memory that a specific team or environment (dev/prod) can use. apiVersion: v1 kind: ResourceQuota metadata: name: mem-cpu-demo spec: hard: requests.cpu: “1” requests.memory: 1Gi limits.cpu: “2” limits.memory: 2Gi

Read More
Kubernetes

Kubernetes: Liveness vs Readiness Probes – Don’t Kill Your Traffic

- 21.02.26 - ErcanOPAK comment on Kubernetes: Liveness vs Readiness Probes – Don’t Kill Your Traffic

If your pod is ‘Alive’ but not ‘Ready’ to serve traffic (e.g., still loading cache), K8s might send traffic to a black hole. Use Readiness Probes. readinessProbe: httpGet: path: /health/ready port: 8080 initialDelaySeconds: 5

Read More
Kubernetes

Kubernetes: Use Resource Requests vs Limits to Optimize Pod Scheduling

- 21.02.26 - ErcanOPAK comment on Kubernetes: Use Resource Requests vs Limits to Optimize Pod Scheduling

Not setting resources leads to unpredictable behavior. Requests guarantee minimum, Limits cap maximum. Understanding the Difference: – Requests: Guaranteed resources (used for scheduling) – Limits: Maximum resources (hard cap) Example Configuration: apiVersion: v1 kind: Pod metadata: name: myapp spec: containers: – name: app image: myapp:1.0 resources: requests: memory: “256Mi” cpu: “250m” # 0.25 CPU core […]

Read More
Kubernetes

Kubernetes: Use Pod Disruption Budget to Ensure Availability During Maintenance

- 17.02.26 - ErcanOPAK comment on Kubernetes: Use Pod Disruption Budget to Ensure Availability During Maintenance

Rolling updates can accidentally take down too many pods. PDB guarantees minimum availability. Create PDB: apiVersion: policy/v1 kind: PodDisruptionBudget metadata: name: myapp-pdb spec: minAvailable: 2 # Always keep at least 2 pods running selector: matchLabels: app: myapp Or Use maxUnavailable: spec: maxUnavailable: 1 # At most 1 pod can be down at a time selector: […]

Read More
Kubernetes

Kubernetes: Use Secrets to Store Sensitive Data Instead of ConfigMaps

- 16.02.26 - ErcanOPAK comment on Kubernetes: Use Secrets to Store Sensitive Data Instead of ConfigMaps

Storing passwords in ConfigMaps exposes them in plain text. Secrets encode data and have better access control. Create Secret: kubectl create secret generic db-secret \ –from-literal=username=admin \ –from-literal=password=secretpass123 Use in Pod: apiVersion: v1 kind: Pod metadata: name: myapp spec: containers: – name: app image: myapp:1.0 env: – name: DB_USER valueFrom: secretKeyRef: name: db-secret key: username […]

Read More
Kubernetes

Kubernetes: Use Horizontal Pod Autoscaler to Scale Based on CPU/Memory

- 15.02.26 - ErcanOPAK comment on Kubernetes: Use Horizontal Pod Autoscaler to Scale Based on CPU/Memory

Manual scaling is reactive and slow. HPA automatically scales pods based on resource usage. Create HPA: kubectl autoscale deployment myapp \ –cpu-percent=70 \ –min=2 \ –max=10 # When CPU > 70%, adds pods (up to 10) # When CPU < 70%, removes pods (down to 2) YAML Version: apiVersion: autoscaling/v2 kind: HorizontalPodAutoscaler metadata: name: myapp-hpa […]

Read More
Kubernetes

Kubernetes: Use ConfigMaps to Store Configuration Separately from Pods

- 15.02.26 - ErcanOPAK comment on Kubernetes: Use ConfigMaps to Store Configuration Separately from Pods

Hardcoding config in containers requires rebuilding images. ConfigMaps separate config from code. Create ConfigMap: kubectl create configmap app-config \ –from-literal=API_URL=https://api.example.com \ –from-literal=MAX_RETRIES=3 Use in Pod: apiVersion: v1 kind: Pod metadata: name: myapp spec: containers: – name: app image: myapp:1.0 envFrom: – configMapRef: name: app-config Change config without rebuilding image – just update ConfigMap! Update ConfigMap: […]

Read More
Kubernetes

Kubernetes: Use kubectl top to Monitor Real-Time Resource Usage

- 14.02.26 - ErcanOPAK comment on Kubernetes: Use kubectl top to Monitor Real-Time Resource Usage

Want to see CPU/Memory usage without installing monitoring tools? kubectl top shows real-time stats. Node Resource Usage: kubectl top nodes # Output: # NAME CPU MEMORY # node-1 45% 2.5Gi # node-2 23% 1.8Gi Pod Resource Usage: kubectl top pods # Or specific namespace: kubectl top pods -n production # Sort by CPU: kubectl top […]

Read More
Kubernetes

Kubernetes: Use kubectl diff Before Applying Changes to Preview Impact

- 13.02.26 - ErcanOPAK comment on Kubernetes: Use kubectl diff Before Applying Changes to Preview Impact

Applying YAML changes blindly is risky. Preview exactly what will change first. Before Applying: # See what kubectl apply will change kubectl diff -f deployment.yaml # Output shows: # – Lines being removed # + Lines being added # ~ Lines being modified Safe Workflow: # 1. Check diff kubectl diff -f deployment.yaml # 2. […]

Read More
Kubernetes

Kubernetes: View Real-Time Pod Logs with Stern Instead of kubectl

- 13.02.26 - ErcanOPAK comment on Kubernetes: View Real-Time Pod Logs with Stern Instead of kubectl

Tired of running kubectl logs for each pod separately? Stern streams logs from multiple pods simultaneously. Install Stern: # Mac brew install stern # Linux wget https://github.com/stern/stern/releases/download/v1.28.0/stern_linux_amd64 Usage: # Tail all pods matching pattern stern my-app # All pods in namespace stern . -n production # Color-coded by pod, auto-follows new pods Why Better: Kubectl […]

Read More
Kubernetes

Kubernetes Ingress: Expose Multiple Services Through One Load Balancer

- 05.02.26 - ErcanOPAK comment on Kubernetes Ingress: Expose Multiple Services Through One Load Balancer

Paying for multiple cloud load balancers? Ingress routes traffic to different services based on hostname or path. # ingress.yaml apiVersion: networking.k8s.io/v1 kind: Ingress metadata: name: main-ingress annotations: # NGINX Ingress Controller nginx.ingress.kubernetes.io/rewrite-target: / nginx.ingress.kubernetes.io/ssl-redirect: “true” nginx.ingress.kubernetes.io/proxy-body-size: “10m” # Cert-Manager for SSL cert-manager.io/cluster-issuer: “letsencrypt-prod” spec: tls: – hosts: – api.example.com – app.example.com – admin.example.com secretName: tls-secret […]

Read More
Kubernetes

Kubernetes: Force Delete Stuck Pods in Terminating State Instantly

- 03.02.26 - ErcanOPAK comment on Kubernetes: Force Delete Stuck Pods in Terminating State Instantly

Pod stuck in “Terminating” state for hours? Kubernetes is waiting for graceful shutdown that will never complete. Force delete it properly. The Problem: # Pod stuck forever kubectl get pods NAME STATUS AGE stuck-pod-abc123 Terminating 3h # Normal delete doesn’t work kubectl delete pod stuck-pod-abc123 # Still shows Terminating… Why Pods Get Stuck: When deleting […]

Read More
Kubernetes

Debug Kubernetes Pods That Keep Crashing Before Logs Disappear

- 01.02.26 | 01.02.26 - ErcanOPAK comment on Debug Kubernetes Pods That Keep Crashing Before Logs Disappear

Your pod crashes in 2 seconds, and logs vanish before you can read them? Here’s how to catch the output before Kubernetes deletes the container. The Problem: When a pod CrashLoops, the container exits so fast that ‘kubectl logs’ shows nothing useful or “container not found” errors. By the time you run the command, Kubernetes […]

Read More
Kubernetes

Why Your Pod “Looks Healthy” But Still Drops Traffic

- 31.01.26 - ErcanOPAK comment on Why Your Pod “Looks Healthy” But Still Drops Traffic

This is a classic production trap. Root cause readinessProbe ≠ livenessProbe Most people use only one. Correct pattern livenessProbe: httpGet: path: /health/live port: 80 readinessProbe: httpGet: path: /health/ready port: 80 Why this matters Liveness = should I restart? Readiness = should I receive traffic? If your app is warming caches or reconnecting DBs, traffic arrives […]

Read More
Kubernetes

Why Pods Restart Even When CPU & Memory Look Fine

- 30.01.26 - ErcanOPAK comment on Why Pods Restart Even When CPU & Memory Look Fine

Everything green… pods still restart. Hidden killer Liveness probes too aggressive Short timeouts during GC pauses Cold starts under load Fix Separate readiness & liveness Increase initialDelaySeconds Avoid HTTP probes on heavy endpoints livenessProbe: initialDelaySeconds: 30 timeoutSeconds: 5  

Read More
Kubernetes

Why Pods Restart Without Errors (OOMKilled Isn’t Always Logged)

- 29.01.26 - ErcanOPAK comment on Why Pods Restart Without Errors (OOMKilled Isn’t Always Logged)

Pods restart, logs look clean. Hidden reason Memory limit hit → kernel kills container → no app log. Check kubectl describe pod <pod-name> Look for: Reason: OOMKilled Fix Increase memory or fix memory leak — don’t just scale blindly.

Read More
Kubernetes

Use Liveness vs Readiness Correctly

- 28.01.26 - ErcanOPAK comment on Use Liveness vs Readiness Correctly

livenessProbe: httpGet: path: /health port: 80 Why it mattersWrong probes cause infinite restarts or traffic to broken pods.

Read More
Kubernetes

Use Resource Requests to Prevent Noisy Neighbors

- 27.01.26 - ErcanOPAK comment on Use Resource Requests to Prevent Noisy Neighbors

resources: requests: cpu: “250m” memory: “256Mi” Why it mattersWithout requests, Kubernetes can’t schedule intelligently → random slowdowns.

Read More
Kubernetes

Why Liveness ≠ Readiness Probes

- 26.01.26 - ErcanOPAK comment on Why Liveness ≠ Readiness Probes

livenessProbe: httpGet: path: /health readinessProbe: httpGet: path: /ready Why it mattersLiveness restarts pods, readiness controls traffic. Mixing them causes outages.

Read More
Kubernetes

Readiness vs Liveness — One Mistake Takes Down Clusters

- 25.01.26 - ErcanOPAK comment on Readiness vs Liveness — One Mistake Takes Down Clusters

Readiness vs Liveness — One Mistake Takes Down Clusters livenessProbe: httpGet: path: /health/live readinessProbe: httpGet: path: /health/ready Why this mattersLiveness restarts pods. Readiness controls traffic. Mixing them causes cascading failures.

Read More
Kubernetes

Why Readiness Probes Matter More Than Liveness

- 24.01.26 - ErcanOPAK comment on Why Readiness Probes Matter More Than Liveness

Most outages happen because traffic hits half-ready pods. readinessProbe: httpGet: path: /health/ready port: 80 Key idea: Liveness = “restart me” Readiness = “send traffic or not” If you only use liveness → Kubernetes will happily route traffic to chaos.

Read More
Kubernetes

Detect CrashLoopBackOff Root Cause in 10 Seconds

- 24.01.26 | 24.01.26 - ErcanOPAK comment on Detect CrashLoopBackOff Root Cause in 10 Seconds

Most people stare at logs too long. Kubernetes already tells you why your pod died. Fastest diagnostic command: kubectl describe pod <pod-name> Look for: Last State: Terminated Reason: OOMKilled Why this matters:Logs may be empty if the container never fully started. Real fix:Increase memory requests, not limits: resources: requests: memory: “512Mi” limits: memory: “1Gi” Result:Stable […]

Read More
Kubernetes

Kubernetes Pods Restart with No CPU or Memory Spikes

- 23.01.26 - ErcanOPAK comment on Kubernetes Pods Restart with No CPU or Memory Spikes

Metrics look clean, pods restart anyway. Why it happensProcess exits with code 0 (app logic exit). Why it mattersKubernetes assumes failure. Vital fix Keep main process alive or use proper controllers.

Read More
Page 3 of 4
« Previous 1 2 3 4 Next »

Posts pagination

« Previous 1 2 3 4 Next »
July 2026
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
2728293031  
« Jun    

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (858)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)
  • How to enable, disable and check if Service Broker is enabled on a database in SQL Server (597)
  • Add Constraint to SQL Table to ensure email contains @ (582)
  • Average of all values in a column that are not zero in SQL (545)
  • How to use Map Mode for Vertical Scroll Mode in Visual Studio (512)
  • Find numbers with more than two decimal places in SQL (460)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes
  • Ajax: Use Axios for HTTP Requests
  • JavaScript: Understand Hoisting
  • HTML: Use Web Storage for Client-Side Data
  • CSS: Use Filter Effects for Visual Magic
  • Windows 11: Unlock God Mode for All Settings

Most Viewed Posts

  • Get the User Name and Domain Name from an Email Address in SQL (960)
  • How to add default value for Entity Framework migrations for DateTime and Bool (898)
  • How to make theater mode the default for Youtube (858)
  • Get the First and Last Word from a String or Sentence in SQL (840)
  • How to select distinct rows in a datatable in C# (814)

Recent Posts

  • C#: Use Using Statements for Resource Management
  • C#: Use Lambda Expressions for Concise Code
  • SQL: Use GROUP BY for Data Aggregation
  • .NET Core: Master Routing for Clean URLs
  • Git: Use Reset to Undo Local Changes

Social

  • ErcanOPAK.com
  • GoodReads
  • LetterBoxD
  • Linkedin
  • The Blog
  • Twitter
© 2026 Bits of .NET | Built with Xblog Plus free WordPress theme by wpthemespace.com