Day- 45: Understanding Ingress in Kubernetes

Day- 45: Understanding Ingress in Kubernetes

Table of contents?

What is Ingress??

Why Use Ingress??

Advantages of Using Ingress?

Real-Life Example?

Manifest File for Ingress?

Testing Ingress?

Conclusion?

Hello DevOps Professionals! ???

Aaj hum baat karenge ek important concept ke baare mein jo Kubernetes environments mein traffic management ke liye use hota hai, aur wo hai Ingress. Agar aap Kubernetes cluster mein applications deploy kar rahe hain aur unhe external world se connect karna chahte hain, to Ingress aapka best friend ban sakta hai. Let’s dive into what Ingress is, why we use it, its advantages, and how to implement it with a real-life example. ???

?

What is Ingress??

Ingress ek Kubernetes object hai jo aapke cluster ke andar run hone wale services ko external world se connect karne ka ek organized tareeka deta hai. Agar simple language mein samjha jaye, to Ingress ek gateway jaisa kaam karta hai jisme aap different routing rules define kar sakte hain, jisse incoming requests automatically sahi service tak pahunch jayein.?

Imagine kijiye ki aapke paas ek multi-service application hai jisme alag-alag services hain, jaise frontend, backend, aur APIs. Ingress aapko help karta hai in services ke beech traffic ko route karne mein, bina har ek service ke liye alag Load Balancer ya NodePort create kiye.?

Why Use Ingress??

To ab sawal aata hai ki kyon use karein Ingress? ???

  1. Simplified Traffic Management: Ingress aapko single entry point se multiple services ke liye routing manage karne ki facility deta hai.?

  1. Cost-Effective: Multiple Load Balancers create karne ki zaroorat nahi, jo aapka cloud cost bhi kam karega.?

  1. Flexible Routing: Aap different rules define kar sakte hain jaise URL-based routing, path-based routing, etc.?

  1. TLS/SSL Termination: Ingress TLS certificates handle kar sakta hai, jisse aap apne applications ko secure kar sakte hain.?

Advantages of Using Ingress?

  • Centralized Access Control: Ingress aapko ek central point deta hai jaha se aap different services ke liye access control kar sakte hain.?

  • Scalability: Ingress aapke applications ko easily scale karne ki facility provide karta hai, without changing the configuration for each service.?

  • Better Security: Ingress aapko HTTPS/TLS termination ka support deta hai, jo aapke data ko secure karne mein help karta hai.?

Real-Life Example?

Sochiye, aap ek e-commerce platform manage kar rahe hain jisme alag-alag services hain: frontend, product service, payment service, etc. Har service ke liye alag Load Balancer create karna costly ho sakta hai, aur isiliye aap Ingress use karte hain.?

Ingress ke through aap URL paths ko different services par route kar sakte hain:?

  • / - Frontend?

  • /products - Product Service?

  • /payments - Payment Service?

Manifest File for Ingress?

Ab chaliye ek example manifest file dekhte hain jisme hum Ingress object define karenge.?

apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  name: example-ingress
  namespace: default
  annotations:
    nginx.ingress.kubernetes.io/rewrite-target: /
spec:
  rules:
  - host: example.com
    http:
      paths:
      - path: /
        pathType: Prefix
        backend:
          service:
            name: frontend-service
            port:
              number: 80
      - path: /products
        pathType: Prefix
        backend:
          service:
            name: product-service
            port:
              number: 80
      - path: /payments
        pathType: Prefix
        backend:
          service:
            name: payment-service
            port:
              number: 80
     
                

Is manifest file mein humne define kiya hai ki kaise example.com domain ke under different paths ko alag-alag services par route kiya jaye.?

Testing Ingress?

Ab aapko check karna hai ki aapka Ingress sahi se kaam kar raha hai ya nahi. Chaliye kuch commands dekhte hain:?

  1. Ingress Create Karne Ke Baad Check Karein:?

kubectl get ingress -n default        

  1. Curl Command se Test Karein:?

curl -H "Host: example.com" https://<Ingress-Controller-IP>
curl -H "Host: example.com" https://<Ingress-Controller-IP>/products
curl -H "Host: example.com" https://<Ingress-Controller-IP>/payments
        

In commands se aap test kar sakte hain ki kya traffic sahi service tak pahunch raha hai.?

Conclusion?

Ingress Kubernetes mein traffic management ko simplify karne ka ek powerful tool hai. Yeh na sirf aapko cost-efficiency provide karta hai, balki better scalability aur security bhi offer karta hai. Agar aap apne Kubernetes cluster mein ek well-organized aur centralized traffic management solution chahte hain, to Ingress is the way to go.?

Connect and Follow Me on Socials?

LINKDIN | GITHUB |TWITTER?

Anand Raval

CSE Undergraduate | AWS Certified Cloud Practitioner | Aspiring Cloud and DevOps | Docker | Kubernetes | Linux | Git, GitHub & GitLab | Jenkins | GCP | Application Testing & Deployment | Content Writer

3 个月

quite good content !!!!

要查看或添加评论,请登录