Ravindra BagaleCourses & study guides मराठी Track your progress

Guides

Kubernetes वर Nginx Ingress कसे सेटअप करावे

ingress-nginx install, host/path Ingress, apply, Host header ने curl, 503 असल्यास Service तपासा.

Friends, Ingress is the front door: host and path to a Service. Chala mitrano — install the controller before you apply rules.

Quick answer

Hold this vertical picture:

  1. controller.
  2. Ingress YAML.
  3. apply.
  4. Host curl.
  5. describe.

Language: English · मराठी · हिंदी

Install controllerOnce per cluster Ingress YAMLhost + path kubectl applyRule stored DNS or Host headerHit the door Service backendPods answer
Nginx Ingress path

Ingress का

Hostname/path > NodePort.

Why: एक entry अनेक apps. What: Ingress + controller. How: Service backends.

Example 1: Ingress object sketch

Type this:

mkdir -p /tmp/ing && printf '%s\n' 'apiVersion: networking.k8s.io/v1' 'kind: Ingress' 'metadata:' '  name: web' 'spec:' '  ingressClassName: nginx' '  rules:' '  - host: web.lab.local' '    http:' '      paths:' '      - path: /' '        pathType: Prefix' '        backend:' '          service:' '            name: web' '            port:' '              number: 80' > /tmp/ing/ingress.yaml && head -6 /tmp/ing/ingress.yaml

You will see:

apiVersion: networking.k8s.io/v1

What it means: Ingress maps host/path to a Service.

Example 2: Controller install reminder

Type this:

printf '%s\n' 'Install the ingress-nginx controller once per cluster before Ingress objects work'

You will see:

Install the ingress-nginx controller once per cluster before Ingress objects work

What it means: An Ingress without a controller stays useless.

Example 9: ingressClassName

Type this:

printf '%s\n' 'ingressClassName: nginx'

You will see:

ingressClassName: nginx

What it means: Selects which controller owns the object when several exist.

Concept 1: Controller

शिवाय ऐकत नाही.

Why: Object एकटे व्यर्थ. What: ingress-nginx + class. How: ADDRESS.

Example 3: kubectl apply ingress

Type this:

printf '%s\n' 'kubectl apply -f ingress.yaml && kubectl get ingress'

You will see:

kubectl apply -f ingress.yaml && kubectl get ingress

What it means: ADDRESS column fills when the controller assigns an LB/IP.

Example 4: curl with Host header

Type this:

printf '%s\n' 'curl -H "Host: web.lab.local" http://127.0.0.1/'

You will see:

curl -H "Host: web.lab.local" http://127.0.0.1/

What it means: Host header must match the rule when DNS is not ready.

Example 10: Local kind port hint

Type this:

printf '%s\n' 'On kind, map node ports or use a port-forward to the controller Service for lab curls'

You will see:

On kind, map node ports or use a port-forward to the controller Service for lab curls

What it means: Cloud uses a LoadBalancer; labs often port-forward.

Concept 2: Host/path

Browser जे पाठवते.

Why: Wrong Host. What: rules. How: curl -H.

Example 5: path based routing

Type this:

printf '%s\n' 'path: /api  -> service api:80' 'path: /    -> service web:80'

You will see:

path: /api  -> service api:80
path: /    -> service web:80

What it means: Longer prefixes can split apps on one host.

Example 6: describe ingress events

Type this:

printf '%s\n' 'kubectl describe ingress web'

You will see:

kubectl describe ingress web

What it means: Shows backend and controller errors.

Example 7: Service must exist

Type this:

printf '%s\n' 'backend service name web must already exist in the same namespace'

You will see:

backend service name web must already exist in the same namespace

What it means: Wrong Service name = 503 from the controller.

Concept 3: Backend/TLS

Service हवी; TLS नंतर.

Why: 503 = bad backend. What: describe; tls. How: cleanup.

Example 8: TLS note

Type this:

printf '%s\n' 'tls: secretName web-tls  # cert-manager can create it later'

You will see:

tls: secretName web-tls  # cert-manager can create it later

What it means: HTTPS is the next chapter after HTTP Ingress works.

Example 11: Delete lab ingress

Type this:

printf '%s\n' 'kubectl delete -f ingress.yaml'

You will see:

kubectl delete -f ingress.yaml

What it means: Clean rules when the demo ends.

Example 12: Why not NodePort forever

Type this:

printf '%s\n' 'NodePort exposes high ports; Ingress gives hostnames and paths teams expect'

You will see:

NodePort exposes high ports; Ingress gives hostnames and paths teams expect

What it means: Amazon/Flipkart edge uses host routing.

Ingress card

1 controller 2 Ingress 3 apply 4 Host curl 5 fix 503

Suppose: empty ADDRESS

Controller/LB.

Suppose: 503

Service name/port.

Ravindra Bagale's Tip

At Flipkart-style clusters, ingress-nginx plus a clear host rule is the default demo. Reviewers ask what a 503 means.

Check yourself (quiz)

Q1. No controller?

no traffic

Q2. Glue?

Service

Q3. Lab curl?

Host header

Q4. 503?

backend

Q5. class?

which controller

Q6. TLS?

secret later

Reading tracking

Mark this guide when you finish. Your browser remembers it on this device.

controller → Ingress → curl Host → Service. Did you understand? Let us try it once more.

Frequently asked questions

Ingress vs Service?

Ingress HTTP routes; Service is the stable VIP to pods.

Why a controller?

It programs the proxy/LB.

Host header?

Matches rules when DNS is missing.

503?

Backend Service missing or wrong.

TLS?

Add tls secretName; cert-manager can issue.

kind lab?

Port-forward or node port to the controller.