Skip to content

Commit 16cfa76

Browse files
author
Fernando Diaz
committed
Enhance the Ingress Addon
- Updates Ingress-Controller Version to 0.18.0 - Adds Service Account for Ingress-Controller - Adds Support for Prometheus - Fixes bug with TCP/UDP ConfigMaps not Loading
1 parent 7c8a3b3 commit 16cfa76

File tree

6 files changed

+177
-10
lines changed

6 files changed

+177
-10
lines changed

Diff for: 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

Diff for: deploy/addons/ingress/ingress-dp.yaml

+17-9
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
@@ -62,24 +64,30 @@ 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.18.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:

Diff for: deploy/addons/ingress/ingress-rbac.yaml

+146
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
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: nginx-ingress-role
74+
namespace: kube-system
75+
labels:
76+
addonmanager.kubernetes.io/mode: Reconcile
77+
rules:
78+
- apiGroups:
79+
- ""
80+
resources:
81+
- configmaps
82+
- pods
83+
- secrets
84+
- namespaces
85+
verbs:
86+
- get
87+
- apiGroups:
88+
- ""
89+
resources:
90+
- configmaps
91+
resourceNames:
92+
# Defaults to "<election-id>-<ingress-class>"
93+
# Here: "<ingress-controller-leader>-<nginx>"
94+
# This has to be adapted if you change either parameter
95+
# when launching the nginx-ingress-controller.
96+
- "ingress-controller-leader-nginx"
97+
verbs:
98+
- get
99+
- update
100+
- apiGroups:
101+
- ""
102+
resources:
103+
- configmaps
104+
verbs:
105+
- create
106+
- apiGroups:
107+
- ""
108+
resources:
109+
- endpoints
110+
verbs:
111+
- get
112+
113+
---
114+
115+
apiVersion: rbac.authorization.k8s.io/v1beta1
116+
kind: RoleBinding
117+
metadata:
118+
name: nginx-ingress-role-binding
119+
labels:
120+
addonmanager.kubernetes.io/mode: Reconcile
121+
roleRef:
122+
apiGroup: rbac.authorization.k8s.io
123+
kind: Role
124+
name: nginx-ingress-role
125+
subjects:
126+
- kind: ServiceAccount
127+
name: nginx-ingress
128+
namespace: kube-system
129+
130+
---
131+
132+
apiVersion: rbac.authorization.k8s.io/v1beta1
133+
kind: ClusterRoleBinding
134+
metadata:
135+
name: system:nginx-ingress
136+
labels:
137+
kubernetes.io/bootstrapping: rbac-defaults
138+
addonmanager.kubernetes.io/mode: Reconcile
139+
roleRef:
140+
apiGroup: rbac.authorization.k8s.io
141+
kind: ClusterRole
142+
name: system:nginx-ingress
143+
subjects:
144+
- kind: ServiceAccount
145+
name: nginx-ingress
146+
namespace: kube-system

Diff for: deploy/addons/ingress/ingress-svc.yaml

+2-1
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

Diff for: 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

Diff for: 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)