GeekCoding101

  • Home
  • GenAI
    • Daily AI Insights
    • Machine Learning
    • Transformer
    • Azure AI
  • DevOps
    • Kubernetes
    • Terraform
  • Technology
    • Cybersecurity
    • System Design
    • Coding Notes
  • About
  • Contact
Kubernetes
Master Kubernetes with hands-on guides on deployment, scaling, security, and monitoring.
Kubernetes

ExternalName and LoadBalancer - Ultimate Kubernetes Tutorial Part 5

Introduction Hey, welcome back to my ultimate Kubernetes tutorials! So far, we've explored ClusterIP and NodePort, but what if you need to route traffic outside your cluster or expose your app with a real external IP? That’s where ExternalName and LoadBalancer services come in. ExternalName lets your pods seamlessly connect to external services using DNS, while LoadBalancer provides a publicly accessible endpoint for your app. In this post, we’ll break down how they work, when to use them, and how to configure them in your Kubernetes cluster. Let’s dive in! 🚀 Exploring ExternalName Service Okay, we're still in my nginx/testpod environment in namespace service-type-test In our last post, we have ClusterIP running, let's delete it to get a clean environment to start: kubectl apply -f /home/admin/nginx-deployment/nginx-clusterip-service.yaml kubectl get service -n service-type-test -o wide You should not see any service is running in above output. Now, let's work on  ExternalName! Creating an ExternalName service is simpler than creating NodePort or ClusterIP , a little bit... create a file /home/admin/nginx-deployment/nginx-externalname-service.yaml: apiVersion: v1 kind: Service metadata: name: nginx-service namespace: service-type-test spec: type: ExternalName externalName: my-nginx.external.local Unlike ClusterIP, NodePort, LoadBalancer, or Headless services, this service does not select backend pods. Instead, it just creates a DNS alias that redirects traffic to an external hostname. So: No selector needed → It does not route traffic to Kubernetes pods. No labels needed → There’s no pod matching required since it’s just a DNS pointer. It simply returns the CNAME record when queried inside the cluster. Simpler on Kubernetes side, but more manual steps on your own side…

March 18, 2025 0comments 157hotness 0likes Geekcoding101 Read all
Kubernetes

NodePort vs ClusterIP - Ultimate Kubernetes Tutorial Part 4

Introduction Hey, welcome back to my ultimate Kubernetes tutorials! Now that our 1 master + 4 worker node cluster is up and running, it’s time to dive into NodePort vs. ClusterIP—two key service types in Kubernetes. Services act as the traffic controllers of your cluster, making sure pods can communicate reliably. Without them, your pods would be like isolated islands, unable to connect in a structured way. Pods are ephemeral, constantly changing IPs. That’s where Kubernetes services step in—ensuring stable access, whether for internal pod-to-pod networking or external exposure. Let’s break down how they work and when to use each! 🚀 Before we start, here comes a quick summary for common Four Kubernetes services: Service Type Description Use Case ClusterIP Exposes the service internally within the cluster. No external access. Internal microservices that only communicate within Kubernetes. NodePort Exposes the service on a static port on each node's IP, making it accessible externally. Basic external access without a LoadBalancer. LoadBalancer Creates an external load balancer that directs traffic to the service. Production environments requiring automated load balancing. ExternalName Maps a Kubernetes Service to an external DNS name instead of forwarding traffic. Redirecting traffic to external services outside the cluster. Ps. Headless Service is also a Kubernetes Service type, but it behaves differently from the usual four. In this post, I will guide you to: ✅ Create an Nginx deployment running on a single node✅ Expose it using a NodePort Service✅ Verify accessibility inside and outside the cluster ✅ Expose it using a ClusterIP Service ✅ Verify accessibility inside and outside…

March 15, 2025 0comments 135hotness 0likes Geekcoding101 Read all
Kubernetes

Ultimate Kubernetes Tutorial Part 3: A Streamlined Kubernetes cluster setup

Introduction Welcome back to the Kubernetes tutorial series! Now that our base image and local server are ready, it’s time for the real action—Kubernetes cluster setup with Flannel. I'll spin up one Kubernetes master and 4 worker nodes, forming a local Kubernetes cluster that’s ready for real workloads. No more theory—let’s build something real! 🚀 Clone baseimage to k8s-1 as The Kubernetes VM Base Image Before jump on our Kubernetes cluster setup, let's start from my Mac's terminal, clone from Base Image - Rocky 9 as k8s-base: ❯ vmrun clone /Users/geekcoding101.com/Virtual\ Machines.localized/baseimage-rocky9.vmwarevm/baseimage-rocky9.vmx /Users/geekcoding101.com/Virtual\ Machines.localized/k8s-1.vmwarevm/k8s-1.vmx full ❯ sed -i '' 's/displayName = "Clone of baseimage-rocky9"/displayName = "k8s-1"/' "/Users/geekcoding101.com/Virtual Machines.localized/k8s-1.vmwarevm/k8s-1.vmx" Make sure you've stopped the baseimage VM, start the k8s-base VM. The steps here I've mentioned details in Part 2, in short, after above command, we need to rescan in VMFusion and SSH as root into the k8s-base using the IP172.16.211.3 of the base VM, preapre the input file /opt/share_tools/init_data/k8s-1_vm_input.json: { "hostname": "k8s-1", "ip": "172.16.8.11", "subnet": "24", "gateway": "172.16.211.2", "dns1": "172.16.211.100", "dns2": "8.8.8.8", "domain": "dev.geekcoding101local.com", "ansible_key_path": "~/.ssh/ansible_ed25519", "ssh_key_path": "~/.ssh/ssh_ed25519" } Then using VMFusion console to login into the VM, perform below command to generate SSH keys and setup networking: ansible-playbook /opt/share_tools/bin/configure_vm.yml -e "input_file_path=/opt/share_tools/init_data/k8s-1_vm_input.json" Now I can connect from SSH passwordlessly via the new IP 172.16.8.11. Test DNS Please note here is testing our local DNS server to ensure it's working in our Kubernetes cluster setup. But it's not going to replace CoreDNS... Anyway, ensure the DNS server localserver(172.16.211.100) we setup in Part 2 is running. Ensure the 172.16.211.100 is on top of  /etc/resolv.conf , should…

March 9, 2025 0comments 239hotness 0likes Geekcoding101 Read all
Kubernetes

Ultimate Kubernetes Tutorial Part 2: DNS server and NTP server Configuration

Introduction Hey there! Ready to take this Kubernetes setup to the next level? 🚀 In Part 1, we got our base VM image up and running—nice work! Now, in Part 2, I am going to clone that image to set up a local server as a DNS server and NTP server. I was considering to incorporate the steps to setup Kubernetes master and worker nodes, but seems too much. Anyway, a real cluster is coming soon! 😎 Excited? Let’s dive in and make some magic happen. 🔥 Create localserver VM Clone from Base Image Rocky 9 vmrun clone /Users/geekcoding101.com/Virtual\ Machines.localized/baseimage-rocky9.vmwarevm/baseimage-rocky9.vmx /Users/geekcoding101.com/Virtual\ Machines.localized/localserver.vmwarevm/localserver.vmx full sed -i '' 's/displayName = "Clone of baseimage-rocky9"/displayName = "localserver"/' "/Users/geekcoding101.com/Virtual Machines.localized/localserver.vmwarevm/localserver.vmx" cat "/Users/geekcoding101.com/Virtual Machines.localized/localserver.vmwarevm/localserver.vmx" | grep disp Above commands is to clone the base VM image (display name in VMFusion is Clone of baseimage-rocky9) as a new one, then update the display name of the new VM to localserver instead of Clone of baseimage-rocky9. Now, you probably need to run a scan in VMware Fusion to see the newly added VM: Customize the Local Server VM First, stop the baseimage VM and start the localserver VM to avoid network conflict. Now we can SSH as root into the localserver VM by using the IP172.16.211.3 of the base VM. Remember the script /opt/share_tools/bin/configure_vm.yml we created in Ultimate Kubernetes Tutorial - Setting Up a Thriving Multi-Node Cluster on Mac: Part 1. Let's preapre the input file /opt/share_tools/init_data/localserver_vm_input.json: { "hostname": "localserver", "ip": "172.16.211.100", "subnet": "24", "gateway": "172.16.211.2", "dns1": "8.8.8.8", "dns2": "8.8.4.4", "domain": "dev.geekcoding101local.com", "ansible_key_path": "~/.ssh/ansible_ed25519", "ssh_key_path": "~/.ssh/ssh_ed25519" } I…

March 3, 2025 0comments 134hotness 0likes Geekcoding101 Read all
Kubernetes

Ultimate Kubernetes Tutorial Part 1: Setting Up a Thriving Multi-Node Cluster on Mac

Introduction Hey there! Welcome to this Kubernetes tutorial! Ever dreamed of running a real multi-node Kubernetes (K8s) cluster on your laptop instead of settling for Minikube’s diet version? A proper real multi-node Kubernetes environment requires virtual machines, and until last year, VMware Fusion was a paid product—an obstacle for many. I know there are alternatives, like KVM, Oracle VirtualBox, and even Minikube’s so-called multi-node mode ----but let’s be real: I’ve got a beast of a MacBook Pro, so why not flex its muscles and spin up a legit multi-node cluster? 🚀 But great news! On November 11, 2024, VMware announced that Fusion and Workstation are now free for all users! The moment I stumbled upon this announcement, I was thrilled. Time to roll up my sleeves, fire up some VMs, and make this cluster a reality. Kick off my Kubernetes tutorial! Let’s dive in! 🚀 Project Overview My Goal In this series of Kubernetes tutorial, I want to set up a full Kubernetes cluster on my MacBook Pro using VMware Fusion, creating multiple VMs to simulate real-world deployment and practice my DevOps and IaC (Infrastructure as Code) skills. Planned Setup Create a VM as Base VM (Rocky Linux 9) Configure networking Update system packages Disable firewalld Enable SSH passwordless login from local Mac to the base VM Set up zsh, tmux, vim and common aliases Install Miniforge for Python environment management Install and configure Ansible Set up a Local Server Node (localserver) Clone from the above base VM image Create an Ansible script to customize the base VM image withe new…

March 1, 2025 0comments 422hotness 1likes Geekcoding101 Read all
Newest Hotest Random
Newest Hotest Random
A 12 Factor Crash Course in Python: Build Clean, Scalable FastAPI Apps the Right Way Golang Range Loop Reference - Why Your Loop Keeps Giving You the Same Pointer (and How to Fix It) Terraform Associate Exam: A Powerful Guide about How to Prepare It Terraform Meta Arguments Unlocked: Practical Patterns for Clean Infrastructure Code Mastering Terraform with AWS Guide Part 1: Launch Real AWS Infrastructure with VPC, IAM and EC2 ExternalName and LoadBalancer - Ultimate Kubernetes Tutorial Part 5
Mastering Terraform with AWS Guide Part 1: Launch Real AWS Infrastructure with VPC, IAM and EC2Terraform Meta Arguments Unlocked: Practical Patterns for Clean Infrastructure CodeTerraform Associate Exam: A Powerful Guide about How to Prepare ItGolang Range Loop Reference - Why Your Loop Keeps Giving You the Same Pointer (and How to Fix It)A 12 Factor Crash Course in Python: Build Clean, Scalable FastAPI Apps the Right Way
Ultimate Kubernetes Tutorial Part 1: Setting Up a Thriving Multi-Node Cluster on Mac Supervised Machine Learning – Day 6 Supervised Machine Learning - Day 1 Ultimate Kubernetes Tutorial Part 3: A Streamlined Kubernetes cluster setup Terminal Mastery: Crafting a Productivity Environment with iTerm, tmux, and Beyond Master Learning Rate and Feature Engineering: Supervised Machine Learning – Day 8
Newest comment
Tag aggregation
Transformer AI Supervised Machine Learning Daily.AI.Insight notes cybersecurity security Machine Learning

COPYRIGHT © 2024 GeekCoding101. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang