Skip to main content

what is IT Networking ? explained here .

IT networking is the practice of connecting multiple computing devices together so they can exchange data, share resources, and communicate with each other . It forms the invisible digital backbone of our world, powering everything from your home Wi-Fi to corporate cloud environments and the global internet. Core Components of a Network To understand how an IT network operates, it helps to look at its fundamental building blocks: Nodes (End Devices) : Any physical device connected to the network that sends or receives information. Examples include laptops, smartphones, servers, printers, and IoT devices like smart TVs. Links (Transmission Media) : The channels used to connect the nodes together. These can be wired (like Ethernet and copper cables or high-speed fiber optics) or wireless (like Wi-Fi, Bluetooth, and cellular signals). Network Devices : Specialized hardware that directs traffic across the network. Switches : Connect multiple devices together within the same local network....

How to setup host based routing in eks with ingress controller ?

Of course. To set up host-based routing in EKS, you define an Ingress resource with multiple rules. Each rule specifies a hostname (e.g., app1.example.com) and maps it to a corresponding backend Service. The AWS Load Balancer Controller reads this resource and provisions an Application Load Balancer (ALB) to route traffic based on the Host header of incoming requests.
Here’s a complete guide.
Prerequisites
A running Amazon EKS cluster.
kubectl configured to connect to your cluster.
The AWS Load Balancer Controller installed in your cluster. This is the standard Ingress controller for EKS.
A registered domain name (e.g., your-domain.com) that you can manage.
Step 1: Deploy Sample Applications
First, let's deploy two different applications to route traffic to: a "coffee" app ☕ and a "tea" app ЁЯН╡. Each application will have a Deployment and a Service.
Save the following YAML as apps.yaml:
# apps.yaml

# --- Coffee App ---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: coffee-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: coffee
  template:
    metadata:
      labels:
        app: coffee
    spec:
      containers:
      - name: coffee-container
        image: hashicorp/http-echo:latest # A simple echo server
        args:
        - "-text=Welcome to the Coffee Service!"
        ports:
        - containerPort: 5678
---
apiVersion: v1
kind: Service
metadata:
  name: coffee-service
spec:
  type: ClusterIP
  selector:
    app: coffee
  ports:
  - protocol: TCP
    port: 80
    targetPort: 5678
---
# --- Tea App ---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: tea-deployment
spec:
  replicas: 2
  selector:
    matchLabels:
      app: tea
  template:
    metadata:
      labels:
        app: tea
    spec:
      containers:
      - name: tea-container
        image: hashicorp/http-echo:latest
        args:
        - "-text=Welcome to the Tea Service!"
        ports:
        - containerPort: 5678
---
apiVersion: v1
kind: Service
metadata:
  name: tea-service
spec:
  type: ClusterIP
  selector:
    app: tea
  ports:
  - protocol: TCP
    port: 80
    targetPort: 5678


Apply this manifest to your cluster:
kubectl apply -f apps.yaml


Step 2: Create the Ingress Resource
Next, create the Ingress resource. This object defines the routing logic. The spec.rules section is where you map each hostname to its backend service.
Save the following as host-based-ingress.yaml. Remember to replace coffee.your-domain.com and tea.your-domain.com with your actual hostnames.
# host-based-ingress.yaml

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: main-ingress
  annotations:
    # This annotation specifies that the ALB should be internet-facing
    alb.ingress.kubernetes.io/scheme: internet-facing
    # This annotation directs the ALB to route traffic directly to pod IPs
    alb.ingress.kubernetes.io/target-type: ip
spec:
  # This field tells Kubernetes that the AWS Load Balancer Controller should manage this Ingress
  ingressClassName: alb
  rules:
    # Rule for requests to the coffee host
    - host: "coffee.your-domain.com"
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: coffee-service # Routes traffic to the coffee-service
                port:
                  number: 80
    # Rule for requests to the tea host
    - host: "tea.your-domain.com"
      http:
        paths:
          - path: /
            pathType: Prefix
            backend:
              service:
                name: tea-service # Routes traffic to the tea-service
                port:
                  number: 80


Apply the Ingress manifest:
kubectl apply -f host-based-ingress.yaml


Step 3: Verify the Load Balancer
The AWS Load Balancer Controller will now provision an ALB in your AWS account. This can take a few minutes.
Check Ingress Status: Find the DNS address of the newly created ALB.
kubectl get ingress main-ingress
Wait until the ADDRESS column is populated with a DNS name (e.g., k8s-...-.elb.amazonaws.com).
Test Routing: Before setting up DNS, you can test the routes using curl and specifying the Host header. Let's say your ALB address is YOUR_ALB_ADDRESS.
Test the coffee route:
# Replace YOUR_ALB_ADDRESS with the address from the previous command
curl http://YOUR_ALB_ADDRESS -H "Host: coffee.your-domain.com"
This should return Welcome to the Coffee Service!.
Test the tea route:
curl http://YOUR_ALB_ADDRESS -H "Host: tea.your-domain.com"
This should return Welcome to the Tea Service!.
Step 4: Configure DNS ЁЯМР
The final step is to point your public hostnames to the ALB.
Go to your DNS provider (e.g., Amazon Route 53, GoDaddy, Cloudflare).
Create two CNAME records:
Record 1:
Name: coffee (or coffee.your-domain.com)
Type: CNAME
Value/Target: The ALB address you got from kubectl get ingress.
Record 2:
Name: tea (or tea.your-domain.com)
Type: CNAME
Value/Target: The same ALB address.
Note: If you use Amazon Route 53, it is best practice to create an A record and use the Alias feature to point it directly to the Application Load Balancer.
After the DNS records propagate, you can access your services using their public URLs:
curl http://coffee.your-domain.com
curl http://tea.your-domain.com



Comments

Popular posts from this blog

рджेрд╡ोрдк्рд╕ рдХी рдкрдв़ाрдИ рдХैрд╕े рдХрд░ें?

 DevOps (рдбेрд╡рдСрдк्рд╕) рдПрдХ рдРрд╕ा рддрд░ीрдХा рд╣ै рдЬो рд╕ॉрдл्рдЯрд╡ेрдпрд░ рдбेрд╡рд▓рдкрдоेंрдЯ (Dev) рдФрд░ IT рдСрдкрд░ेрд╢рди्рд╕ (Ops) рдХो рдПрдХ рд╕ाрде рд▓ाрддा рд╣ै। рдЗрд╕рдХा рдоुрдЦ्рдп рд▓рдХ्рд╖्рдп рд╕ॉрдл्рдЯрд╡ेрдпрд░ рдмрдиाрдиे, рдЯेрд╕्рдЯ рдХрд░рдиे рдФрд░ рдбिрд▓ीрд╡рд░ рдХрд░рдиे рдХी рдк्рд░рдХ्рд░िрдпा рдХो рддेрдЬ рдФрд░ рдЕрдзिрдХ рд╡िрд╢्рд╡рд╕рдиीрдп рдмрдиाрдиा рд╣ै। DevOps рдХी рдкрдв़ाрдИ рдХे рд▓िрдП рдЖрдк рдиीрдЪे рджिрдП рдЧрдП рд╕्рдЯेрдк्рд╕ рдХो рдлॉрд▓ो рдХрд░ рд╕рдХрддे рд╣ैं: 1. рдоूрд▓рднूрдд рдЕрд╡рдзाрд░рдгाрдУं рдХो рд╕рдордЭें рд╕рдмрд╕े рдкрд╣рд▓े, рдЖрдкрдХो DevOps рдХ्рдпा рд╣ै, рдпрд╣ рдХ्рдпों рдорд╣рдд्рд╡рдкूрд░्рдг рд╣ै, рдФрд░ рдЗрд╕рдХे рдоुрдЦ्рдп рдЪрд░рдг (рдЬैрд╕े рдХंрдЯीрди्рдпूрдЕрд╕ рдЗंрдЯीрдЧ्рд░ेрд╢рди, рдХंрдЯीрди्рдпूрдЕрд╕ рдбिрд▓ीрд╡рд░ी, рдоॉрдиिрдЯрд░िंрдЧ) рдХो рд╕рдордЭрдиा рд╣ोрдЧा। DevOps рдПрдЬाрдЗрд▓ рдоेрдеोрдбोрд▓ॉрдЬी (Agile methodology) рд╕े рдмрд╣ुрдд рдк्рд░ेрд░िрдд рд╣ै, рдЗрд╕рд▓िрдП рдПрдЬाрдЗрд▓ рдХे рд╕िрдж्рдзांрддों рдХो рд╕рдордЭрдиा рднी рдорджрджрдЧाрд░ рд╣ोрдЧा। 2. рдЖрд╡рд╢्рдпрдХ рд╕्рдХिрд▓्рд╕ рдФрд░ рдЯूрд▓्рд╕ рд╕ीрдЦें DevOps рдЗंрдЬीрдиिрдпрд░ рдмрдирдиे рдХे рд▓िрдП рдХुрдЫ рдк्рд░рдоुрдЦ рд╕्рдХिрд▓्рд╕ рдФрд░ рдЯूрд▓्рд╕ рдоें рдорд╣ाрд░рдд рд╣ाрд╕िрд▓ рдХрд░рдиी рд╣ोрдЧी:  * рдк्рд░ोрдЧ्рд░ाрдоिंрдЧ рд╕्рдХिрд▓्рд╕ (Programming Skills): рдХрдо рд╕े рдХрдо рдПрдХ рд╕्рдХ्рд░िрдк्рдЯिंрдЧ рднाрд╖ा (рдЬैрд╕े Python, Bash, Ruby) рдХा рдЬ्рдЮाрди рдЖрд╡рд╢्рдпрдХ рд╣ै, рдХ्рдпोंрдХि рдСрдЯोрдоेрд╢рди рдоें рдЗрдирдХा рдЙрдкрдпोрдЧ рд╣ोрддा рд╣ै। Java, JavaScript, рдпा SQL рдХा рдЬ्рдЮाрди рднी рдлाрдпрджेрдоंрдж рд╣ो рд╕рдХрддा рд╣ै।  * Linux/Unix: рдСрдкрд░ेрдЯिंрдЧ рд╕िрд╕्рдЯрдо (OS) рдХी рдЧрд╣рд░ी рд╕рдордЭ, рдЦाрд╕рдХрд░ Linux рдХрдоांрдб-рд▓ाрдЗрди рдФрд░ рдлाрдЗ...

15 Essential Steps to Kickstart Your DevOps Career

 Here are some tips for learning DevOps in your career: 1. Start with the basics : Understand the fundamentals of DevOps, including continuous integration, continuous delivery, and continuous monitoring. 2. Learn about tools : Familiarize yourself with popular DevOps tools such as Jenkins, Docker, Kubernetes, Ansible, and Git. 3. Get hands-on experience : Practice using DevOps tools and technologies to build, deploy, and manage applications. 4. Focus on automation : Automation is a key aspect of DevOps. Learn how to automate repetitive tasks and processes. 5. Develop your scripting skills : Scripting skills are essential for DevOps. Learn languages like Python, Ruby, or PowerShell. 6. Understand cloud computing : Cloud computing is a critical component of DevOps. Learn about cloud providers like AWS, Azure, or Google Cloud. 7. Learn about security : Security is a top priority in DevOps. Learn about security best practices and tools like vulnerability scanning and compliance. 8. Joi...