Skip to content

Commit

Permalink
Enhance the Ingress Addon
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Fernando Diaz committed Aug 29, 2018
1 parent 7c8a3b3 commit 16cfa76
Show file tree
Hide file tree
Showing 6 changed files with 177 additions and 10 deletions.
4 changes: 4 additions & 0 deletions deploy/addons/ingress/ingress-configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ kind: ConfigMap
metadata:
name: tcp-services
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: EnsureExists
---
apiVersion: v1
kind: ConfigMap
metadata:
name: udp-services
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: EnsureExists
26 changes: 17 additions & 9 deletions deploy/addons/ingress/ingress-dp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ metadata:
name: default-http-backend
namespace: kube-system
labels:
app.kubernetes.io/name: default-http-backend
app.kubernetes.io/part-of: kube-system
addonmanager.kubernetes.io/mode: Reconcile
spec:
replicas: 1
selector:
matchLabels:
app: default-http-backend
app.kubernetes.io/name: default-http-backend
addonmanager.kubernetes.io/mode: Reconcile
template:
metadata:
labels:
app: default-http-backend
app.kubernetes.io/name: default-http-backend
addonmanager.kubernetes.io/mode: Reconcile
spec:
terminationGracePeriodSeconds: 60
Expand Down Expand Up @@ -62,24 +64,30 @@ metadata:
name: nginx-ingress-controller
namespace: kube-system
labels:
app: nginx-ingress-controller
app.kubernetes.io/name: nginx-ingress-controller
app.kubernetes.io/part-of: kube-system
addonmanager.kubernetes.io/mode: Reconcile
spec:
replicas: 1
selector:
matchLabels:
app: nginx-ingress-controller
app.kubernetes.io/name: nginx-ingress-controller
app.kubernetes.io/part-of: kube-system
addonmanager.kubernetes.io/mode: Reconcile
template:
metadata:
labels:
app: nginx-ingress-controller
name: nginx-ingress-controller
app.kubernetes.io/name: nginx-ingress-controller
app.kubernetes.io/part-of: kube-system
addonmanager.kubernetes.io/mode: Reconcile
annotations:
prometheus.io/port: '10254'
prometheus.io/scrape: 'true'
spec:
serviceAccountName: nginx-ingress
terminationGracePeriodSeconds: 60
containers:
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.16.2
- image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.18.0
name: nginx-ingress-controller
imagePullPolicy: IfNotPresent
readinessProbe:
Expand Down Expand Up @@ -108,8 +116,7 @@ spec:
hostPort: 80
- containerPort: 443
hostPort: 443
# we expose 18080 to access nginx stats in url /nginx-status
# this is optional
# (Optional) we expose 18080 to access nginx stats in url /nginx-status
- containerPort: 18080
hostPort: 18080
args:
Expand All @@ -118,6 +125,7 @@ spec:
- --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
- --annotations-prefix=nginx.ingress.kubernetes.io
# use minikube IP address in ingress status field
- --report-node-internal-ip-address
securityContext:
Expand Down
146 changes: 146 additions & 0 deletions deploy/addons/ingress/ingress-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
---

apiVersion: v1
kind: ServiceAccount
metadata:
name: nginx-ingress
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: Reconcile

---

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRole
metadata:
name: system:nginx-ingress
labels:
kubernetes.io/bootstrapping: rbac-defaults
addonmanager.kubernetes.io/mode: Reconcile
rules:
- apiGroups:
- ""
resources:
- configmaps
- endpoints
- nodes
- pods
- secrets
verbs:
- list
- watch
- apiGroups:
- ""
resources:
- nodes
verbs:
- get
- apiGroups:
- ""
resources:
- services
verbs:
- get
- list
- watch
- apiGroups:
- "extensions"
resources:
- ingresses
verbs:
- get
- list
- watch
- apiGroups:
- ""
resources:
- events
verbs:
- create
- patch
- apiGroups:
- "extensions"
resources:
- ingresses/status
verbs:
- update

---

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: Role
metadata:
name: nginx-ingress-role
namespace: kube-system
labels:
addonmanager.kubernetes.io/mode: Reconcile
rules:
- apiGroups:
- ""
resources:
- configmaps
- pods
- secrets
- namespaces
verbs:
- get
- apiGroups:
- ""
resources:
- configmaps
resourceNames:
# Defaults to "<election-id>-<ingress-class>"
# Here: "<ingress-controller-leader>-<nginx>"
# This has to be adapted if you change either parameter
# when launching the nginx-ingress-controller.
- "ingress-controller-leader-nginx"
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- ""
resources:
- endpoints
verbs:
- get

---

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: nginx-ingress-role-binding
labels:
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: nginx-ingress-role
subjects:
- kind: ServiceAccount
name: nginx-ingress
namespace: kube-system

---

apiVersion: rbac.authorization.k8s.io/v1beta1
kind: ClusterRoleBinding
metadata:
name: system:nginx-ingress
labels:
kubernetes.io/bootstrapping: rbac-defaults
addonmanager.kubernetes.io/mode: Reconcile
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:nginx-ingress
subjects:
- kind: ServiceAccount
name: nginx-ingress
namespace: kube-system
3 changes: 2 additions & 1 deletion deploy/addons/ingress/ingress-svc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ metadata:
name: default-http-backend
namespace: kube-system
labels:
app: default-http-backend
app.kubernetes.io/name: default-http-backend
app.kubernetes.io/part-of: kube-system
kubernetes.io/minikube-addons: ingress
kubernetes.io/minikube-addons-endpoint: ingress
addonmanager.kubernetes.io/mode: Reconcile
Expand Down
3 changes: 3 additions & 0 deletions docs/contributors/build_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ $ cd $GOPATH/src/k8s.io/minikube
$ make
```

Note: Make sure that you uninstall any previous versions of minikube before building
from the source.

### Building from Source in Docker (using Debian stretch image with golang)
Clone minikube:
```shell
Expand Down
5 changes: 5 additions & 0 deletions pkg/minikube/assets/addons.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,11 @@ var Addons = map[string]*Addon{
constants.AddonsPath,
"ingress-configmap.yaml",
"0640"),
NewBinDataAsset(
"deploy/addons/ingress/ingress-rbac.yaml",
constants.AddonsPath,
"ingress-rbac.yaml",
"0640"),
NewBinDataAsset(
"deploy/addons/ingress/ingress-dp.yaml",
constants.AddonsPath,
Expand Down

0 comments on commit 16cfa76

Please sign in to comment.