Skip to content

Commit 8db0ec4

Browse files
author
Fernando Diaz
committed
Enhance the Ingress Controller Addon
- Updates Ingress-Controller Version to 0.19.0 - Adds Service Account for Ingress-Controller - Adds Support for Prometheus - Fixes bug with TCP/UDP ConfigMaps not Loading - Adds more resource limits to default-backend - Use new ingress class name - Use app.kubernetes.io/xxxxxxxxxxx labels
1 parent 7c8a3b3 commit 8db0ec4

File tree

6 files changed

+186
-16
lines changed

6 files changed

+186
-16
lines changed

deploy/addons/ingress/ingress-configmap.yaml

+4
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,13 @@ kind: ConfigMap
2929
metadata:
3030
name: tcp-services
3131
namespace: kube-system
32+
labels:
33+
addonmanager.kubernetes.io/mode: EnsureExists
3234
---
3335
apiVersion: v1
3436
kind: ConfigMap
3537
metadata:
3638
name: udp-services
3739
namespace: kube-system
40+
labels:
41+
addonmanager.kubernetes.io/mode: EnsureExists

deploy/addons/ingress/ingress-dp.yaml

+22-14
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,19 @@ metadata:
1818
name: default-http-backend
1919
namespace: kube-system
2020
labels:
21+
app.kubernetes.io/name: default-http-backend
22+
app.kubernetes.io/part-of: kube-system
2123
addonmanager.kubernetes.io/mode: Reconcile
2224
spec:
2325
replicas: 1
2426
selector:
2527
matchLabels:
26-
app: default-http-backend
28+
app.kubernetes.io/name: default-http-backend
2729
addonmanager.kubernetes.io/mode: Reconcile
2830
template:
2931
metadata:
3032
labels:
31-
app: default-http-backend
33+
app.kubernetes.io/name: default-http-backend
3234
addonmanager.kubernetes.io/mode: Reconcile
3335
spec:
3436
terminationGracePeriodSeconds: 60
@@ -37,7 +39,7 @@ spec:
3739
# Any image is permissible as long as:
3840
# 1. It serves a 404 page at /
3941
# 2. It serves 200 on a /healthz endpoint
40-
image: k8s.gcr.io/defaultbackend:1.4
42+
image: gcr.io/google_containers/defaultbackend:1.4
4143
imagePullPolicy: IfNotPresent
4244
livenessProbe:
4345
httpGet:
@@ -50,36 +52,42 @@ spec:
5052
- containerPort: 8080
5153
resources:
5254
limits:
53-
cpu: 10m
54-
memory: 20Mi
55+
cpu: 20m
56+
memory: 30Mi
5557
requests:
56-
cpu: 10m
57-
memory: 20Mi
58+
cpu: 20m
59+
memory: 30Mi
5860
---
5961
apiVersion: extensions/v1beta1
6062
kind: Deployment
6163
metadata:
6264
name: nginx-ingress-controller
6365
namespace: kube-system
6466
labels:
65-
app: nginx-ingress-controller
67+
app.kubernetes.io/name: nginx-ingress-controller
68+
app.kubernetes.io/part-of: kube-system
6669
addonmanager.kubernetes.io/mode: Reconcile
6770
spec:
6871
replicas: 1
6972
selector:
7073
matchLabels:
71-
app: nginx-ingress-controller
74+
app.kubernetes.io/name: nginx-ingress-controller
75+
app.kubernetes.io/part-of: kube-system
7276
addonmanager.kubernetes.io/mode: Reconcile
7377
template:
7478
metadata:
7579
labels:
76-
app: nginx-ingress-controller
77-
name: nginx-ingress-controller
80+
app.kubernetes.io/name: nginx-ingress-controller
81+
app.kubernetes.io/part-of: kube-system
7882
addonmanager.kubernetes.io/mode: Reconcile
83+
annotations:
84+
prometheus.io/port: '10254'
85+
prometheus.io/scrape: 'true'
7986
spec:
87+
serviceAccountName: nginx-ingress
8088
terminationGracePeriodSeconds: 60
8189
containers:
82-
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.16.2
90+
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.19.0
8391
name: nginx-ingress-controller
8492
imagePullPolicy: IfNotPresent
8593
readinessProbe:
@@ -108,8 +116,7 @@ spec:
108116
hostPort: 80
109117
- containerPort: 443
110118
hostPort: 443
111-
# we expose 18080 to access nginx stats in url /nginx-status
112-
# this is optional
119+
# (Optional) we expose 18080 to access nginx stats in url /nginx-status
113120
- containerPort: 18080
114121
hostPort: 18080
115122
args:
@@ -118,6 +125,7 @@ spec:
118125
- --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
119126
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
120127
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
128+
- --annotations-prefix=nginx.ingress.kubernetes.io
121129
# use minikube IP address in ingress status field
122130
- --report-node-internal-ip-address
123131
securityContext:
+149
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
---
2+
3+
apiVersion: v1
4+
kind: ServiceAccount
5+
metadata:
6+
name: nginx-ingress
7+
namespace: kube-system
8+
labels:
9+
addonmanager.kubernetes.io/mode: Reconcile
10+
11+
---
12+
13+
apiVersion: rbac.authorization.k8s.io/v1beta1
14+
kind: ClusterRole
15+
metadata:
16+
name: system:nginx-ingress
17+
labels:
18+
kubernetes.io/bootstrapping: rbac-defaults
19+
addonmanager.kubernetes.io/mode: Reconcile
20+
rules:
21+
- apiGroups:
22+
- ""
23+
resources:
24+
- configmaps
25+
- endpoints
26+
- nodes
27+
- pods
28+
- secrets
29+
verbs:
30+
- list
31+
- watch
32+
- apiGroups:
33+
- ""
34+
resources:
35+
- nodes
36+
verbs:
37+
- get
38+
- apiGroups:
39+
- ""
40+
resources:
41+
- services
42+
verbs:
43+
- get
44+
- list
45+
- watch
46+
- apiGroups:
47+
- "extensions"
48+
resources:
49+
- ingresses
50+
verbs:
51+
- get
52+
- list
53+
- watch
54+
- apiGroups:
55+
- ""
56+
resources:
57+
- events
58+
verbs:
59+
- create
60+
- patch
61+
- apiGroups:
62+
- "extensions"
63+
resources:
64+
- ingresses/status
65+
verbs:
66+
- update
67+
68+
---
69+
70+
apiVersion: rbac.authorization.k8s.io/v1beta1
71+
kind: Role
72+
metadata:
73+
name: system::nginx-ingress-role
74+
namespace: kube-system
75+
labels:
76+
kubernetes.io/bootstrapping: rbac-defaults
77+
addonmanager.kubernetes.io/mode: Reconcile
78+
rules:
79+
- apiGroups:
80+
- ""
81+
resources:
82+
- configmaps
83+
- pods
84+
- secrets
85+
- namespaces
86+
verbs:
87+
- get
88+
- apiGroups:
89+
- ""
90+
resources:
91+
- configmaps
92+
resourceNames:
93+
# Defaults to "<election-id>-<ingress-class>"
94+
# Here: "<ingress-controller-leader>-<nginx>"
95+
# This has to be adapted if you change either parameter
96+
# when launching the nginx-ingress-controller.
97+
- ingress-controller-leader-nginx
98+
verbs:
99+
- get
100+
- update
101+
- apiGroups:
102+
- ""
103+
resources:
104+
- configmaps
105+
verbs:
106+
- create
107+
- apiGroups:
108+
- ""
109+
resources:
110+
- endpoints
111+
verbs:
112+
- get
113+
114+
---
115+
116+
apiVersion: rbac.authorization.k8s.io/v1beta1
117+
kind: RoleBinding
118+
metadata:
119+
name: system::nginx-ingress-role-binding
120+
namespace: kube-system
121+
labels:
122+
kubernetes.io/bootstrapping: rbac-defaults
123+
addonmanager.kubernetes.io/mode: EnsureExists
124+
roleRef:
125+
apiGroup: rbac.authorization.k8s.io
126+
kind: Role
127+
name: system::nginx-ingress-role
128+
subjects:
129+
- kind: ServiceAccount
130+
name: nginx-ingress
131+
namespace: kube-system
132+
133+
---
134+
135+
apiVersion: rbac.authorization.k8s.io/v1beta1
136+
kind: ClusterRoleBinding
137+
metadata:
138+
name: system:nginx-ingress
139+
labels:
140+
kubernetes.io/bootstrapping: rbac-defaults
141+
addonmanager.kubernetes.io/mode: EnsureExists
142+
roleRef:
143+
apiGroup: rbac.authorization.k8s.io
144+
kind: ClusterRole
145+
name: system:nginx-ingress
146+
subjects:
147+
- kind: ServiceAccount
148+
name: nginx-ingress
149+
namespace: kube-system

deploy/addons/ingress/ingress-svc.yaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ metadata:
1818
name: default-http-backend
1919
namespace: kube-system
2020
labels:
21-
app: default-http-backend
21+
app.kubernetes.io/name: default-http-backend
22+
app.kubernetes.io/part-of: kube-system
2223
kubernetes.io/minikube-addons: ingress
2324
kubernetes.io/minikube-addons-endpoint: ingress
2425
addonmanager.kubernetes.io/mode: Reconcile
@@ -29,4 +30,4 @@ spec:
2930
targetPort: 8080
3031
nodePort: 30001
3132
selector:
32-
app: default-http-backend
33+
app.kubernetes.io/name: default-http-backend

docs/contributors/build_guide.md

+3
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ $ cd $GOPATH/src/k8s.io/minikube
2121
$ make
2222
```
2323

24+
Note: Make sure that you uninstall any previous versions of minikube before building
25+
from the source.
26+
2427
### Building from Source in Docker (using Debian stretch image with golang)
2528
Clone minikube:
2629
```shell

pkg/minikube/assets/addons.go

+5
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,11 @@ var Addons = map[string]*Addon{
203203
constants.AddonsPath,
204204
"ingress-configmap.yaml",
205205
"0640"),
206+
NewBinDataAsset(
207+
"deploy/addons/ingress/ingress-rbac.yaml",
208+
constants.AddonsPath,
209+
"ingress-rbac.yaml",
210+
"0640"),
206211
NewBinDataAsset(
207212
"deploy/addons/ingress/ingress-dp.yaml",
208213
constants.AddonsPath,

0 commit comments

Comments
 (0)