-
Notifications
You must be signed in to change notification settings - Fork 2
/
microk8s-ingress.yaml
89 lines (89 loc) · 2.96 KB
/
microk8s-ingress.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-ingress-tcp-microk8s-conf
namespace: ingress
data:
#<port>: "<namespace>/<service name>:<port>"
8000: "development/server-service:8000"
---
# This *replaces* the default microk8s ingress controller (which listens only on ports 80 and 443) with one that listens
# to any port specified in the various ConfigMaps. In our case this is port 8000, as that is the port we're using for
# development purposes. Note that if you try to use microk8s with this controller in place, you'll have to add your
# ports and service mappings to the config map, and it's possible that this may mess with the functionality of actual
# Ingress specifications.
apiVersion: apps/v1
kind: DaemonSet
metadata:
name: nginx-ingress-microk8s-controller
namespace: ingress
labels:
microk8s-application: nginx-ingress-microk8s
spec:
selector:
matchLabels:
name: nginx-ingress-microk8s
template:
metadata:
labels:
name: nginx-ingress-microk8s
spec:
terminationGracePeriodSeconds: 60
dnsPolicy: ClusterFirstWithHostNet
# Note that hostNetwork is required so that we can specify arbitrary ports in the ConfigMap
hostNetwork: true
serviceAccountName: nginx-ingress-microk8s-serviceaccount
containers:
- image: k8s.gcr.io/ingress-nginx/controller:v0.44.0
name: nginx-ingress-microk8s
livenessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
readinessProbe:
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
failureThreshold: 3
timeoutSeconds: 5
lifecycle:
preStop:
exec:
command:
- /wait-shutdown
securityContext:
capabilities:
add:
- NET_BIND_SERVICE
drop:
- ALL
runAsUser: 101 # www-data
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: health
containerPort: 10254
hostPort: 10254
args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/nginx-load-balancer-microk8s-conf
- --tcp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-tcp-microk8s-conf
- --udp-services-configmap=$(POD_NAMESPACE)/nginx-ingress-udp-microk8s-conf
- --ingress-class=public
- --publish-status-address=127.0.0.1