Skip to content

Commit

Permalink
Enhance the Ingress Controller Addon
Browse files Browse the repository at this point in the history
- 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
  • Loading branch information
Fernando Diaz committed Sep 6, 2018
1 parent 82e9914 commit cc497ee
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 18 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
36 changes: 22 additions & 14 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 All @@ -37,7 +39,7 @@ spec:
# Any image is permissible as long as:
# 1. It serves a 404 page at /
# 2. It serves 200 on a /healthz endpoint
image: k8s.gcr.io/defaultbackend:1.4
image: gcr.io/google_containers/defaultbackend:1.4
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
Expand All @@ -50,36 +52,42 @@ spec:
- containerPort: 8080
resources:
limits:
cpu: 10m
memory: 20Mi
cpu: 20m
memory: 30Mi
requests:
cpu: 10m
memory: 20Mi
cpu: 20m
memory: 30Mi
---
apiVersion: extensions/v1beta1
kind: Deployment
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.19.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
149 changes: 149 additions & 0 deletions deploy/addons/ingress/ingress-rbac.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,149 @@
---

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: system::nginx-ingress-role
namespace: kube-system
labels:
kubernetes.io/bootstrapping: rbac-defaults
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: system::nginx-ingress-role-binding
namespace: kube-system
labels:
kubernetes.io/bootstrapping: rbac-defaults
addonmanager.kubernetes.io/mode: EnsureExists
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: system::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: EnsureExists
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: system:nginx-ingress
subjects:
- kind: ServiceAccount
name: nginx-ingress
namespace: kube-system
5 changes: 3 additions & 2 deletions 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 All @@ -29,4 +30,4 @@ spec:
targetPort: 8080
nodePort: 30001
selector:
app: default-http-backend
app.kubernetes.io/name: default-http-backend
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
2 changes: 1 addition & 1 deletion test/integration/cluster_status_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ func testClusterStatus(t *testing.T) {
}
if status != api.ConditionTrue {
err := fmt.Errorf("Component %s is not Healthy! Status: %s", i.GetName(), status)
t.Log("Retrying, %s", err)
t.Logf("Retrying, %s", err)
return err
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/integration/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ func WaitForIngressControllerRunning(t *testing.T) error {
return errors.Wrap(err, "waiting for ingress-controller deployment to stabilize")
}

selector := labels.SelectorFromSet(labels.Set(map[string]string{"app": "nginx-ingress-controller"}))
selector := labels.SelectorFromSet(labels.Set(map[string]string{"app.kubernetes.io/name": "nginx-ingress-controller"}))
if err := commonutil.WaitForPodsWithLabelRunning(client, "kube-system", selector); err != nil {
return errors.Wrap(err, "waiting for ingress-controller pods")
}
Expand Down

0 comments on commit cc497ee

Please sign in to comment.