kubernetes-bootstrapping/05-ingress-controller-nginx/README.md

89 lines
2.1 KiB
Markdown
Raw Normal View History

2023-12-31 18:26:32 +00:00
# 05 | Ingress Controller = NGINX
2023-12-23 02:54:51 +00:00
2023-12-23 05:24:31 +00:00
[https://kubernetes.github.io/ingress-nginx/](https://kubernetes.github.io/ingress-nginx/)
2023-12-31 18:26:32 +00:00
2023-12-23 05:24:31 +00:00
[https://github.com/kubernetes/ingress-nginx](https://github.com/kubernetes/ingress-nginx)
2023-12-31 18:26:32 +00:00
The ingress controller provides external access to services in the cluster by acting as a reverse proxy. In this case, I've selected nginx which is simple to configure, and very fast. It does not have as many fancy features as some other options though.
2023-12-23 02:54:51 +00:00
```bash
helm upgrade --install ingress-nginx ingress-nginx --repo https://kubernetes.github.io/ingress-nginx --namespace ingress-nginx --create-namespace -f values.yaml
```
Example usage:
```yaml
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: ingress-mandelmapper
2024-02-19 00:59:20 +00:00
annotations:
cert-manager.io/issuer: letsencrypt
spec:
ingressClassName: nginx
rules:
- host: mandelmap.home.stevenpolley.net
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: mandelmapper
port:
number: 6161
2024-02-19 00:59:20 +00:00
tls:
- hosts:
- mandelmap.home.stevenpolley.net
secretName: mandelmap-cert
2023-12-31 18:26:32 +00:00
---
apiVersion: networking.k8s.io/v1
2023-12-23 02:54:51 +00:00
kind: Ingress
metadata:
name: ingress-myservicea
spec:
ingressClassName: nginx
rules:
- host: myservicea.foo.org
http:
paths:
- path: /
backend:
service:
name: myservicea
port:
number: 8080
2023-12-23 02:54:51 +00:00
---
apiVersion: networking.k8s.io/v1
2023-12-23 02:54:51 +00:00
kind: Ingress
metadata:
name: ingress-myserviceb
2024-02-19 00:59:20 +00:00
cert-manager.io/issuer: letsencrypt
2023-12-23 02:54:51 +00:00
spec:
ingressClassName: nginx
rules:
- host: myserviceb.foo.org
http:
paths:
- path: /
backend:
service:
name: myserviceb
port:
number: 8443
2023-12-23 02:54:51 +00:00
tls:
- hosts:
- myserviceb.foo.org
secretName: example-tls
---
2024-02-19 00:59:20 +00:00
# A secret must also be provided, this will be created by cert-manager
2023-12-23 02:54:51 +00:00
apiVersion: v1
kind: Secret
metadata:
name: example-tls
data:
tls.crt: <base64 encoded cert>
tls.key: <base64 encoded key>
type: kubernetes.io/tls
```