Member-only story

Kubernetes Ingress in Practice

Maciej
4 min readOct 19, 2020

--

What is Ingress?

Kubernetes ServiceIs L4 control, but Kubernetes Ingressis L7 control.
This is very convenient because you can control path-based routing.

YAML file which we can apply

Please apply in order from the top.

Namespace definition:

apiVersion: v1
kind: Namespace
metadata:
name: ingress-sample

App definition:

apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-deploy-nginx
namespace: ingress-sample
spec:
replicas: 8
selector:
matchLabels:
app: ingress-deploy-nginx
template:
metadata:
labels:
app: ingress-deploy-nginx
spec:
containers:
- name: ingress-deploy-nginx
image: nginx
resources:
limits:
memory: "50Mi"
cpu: "100m"
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-deploy-apache
namespace: ingress-sample
spec:
replicas: 8
selector:
matchLabels:
app: ingress-deploy-apache
template:
metadata:
labels:
app: ingress-deploy-apache
spec:
containers:
- name: ingress-deploy-apache
image: httpd
resources:
limits:
memory: "50Mi"
cpu: "100m"
ports:
- containerPort: 80
---
apiVersion: apps/v1
kind…

--

--

Maciej
Maciej

Written by Maciej

DevOps Consultant. I’m strongly focused on automation, security, and reliability.

No responses yet