Day- 45: Understanding Ingress in Kubernetes
priyadarshi ranjan
Helping Organizations with Devops , Orchestration & Cloud | Docker | Terraform | Kubernetes | Ansible | AWS | Git & Github | Grafana | Prometheus | Linux | Python | Jenkins | GitLab |Jira |SonarQube | Owasp | Trivy
Table of contents?
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? ???
Advantages of Using Ingress?
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:?
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:?
kubectl get ingress -n default
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?
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 !!!!