The cluster is running, pods are healthy, services are online—yet the outside world can’t reach them. This is where Kubernetes Ingress comes in, and kubectl is your direct control.
Ingress defines external access to internal services. Unlike a NodePort or LoadBalancer Service, an Ingress lets you route traffic based on hostnames and paths. It also integrates with TLS to secure requests. Using kubectl, you configure and inspect these rules without leaving your terminal.
Create an Ingress with Kubectl
First, ensure an Ingress controller is deployed. Popular options include NGINX, Traefik, and HAProxy. Without a controller, Ingress resources will sit idle.
Define an Ingress manifest (ingress.yaml):
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: demo-ingress
spec:
rules:
- host: app.example.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: demo-service
port:
number: 80
Apply it: