285 lines
8.3 KiB
Cheetah
285 lines
8.3 KiB
Cheetah
# Copyright 2016 The Kubernetes Authors All rights reserved.
|
|
#
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
# you may not use this file except in compliance with the License.
|
|
# You may obtain a copy of the License at
|
|
#
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
#
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
# See the License for the specific language governing permissions and
|
|
# limitations under the License.
|
|
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ingress-nginx-controller
|
|
namespace: kube-system
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/part-of: kube-system
|
|
app.kubernetes.io/component: controller
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
spec:
|
|
replicas: 1
|
|
strategy:
|
|
type: RollingUpdate
|
|
rollingUpdate:
|
|
# maxUnavailable needs to be 1 so that port conflicts between the old and new pod doesn't happen when using hostPort
|
|
maxUnavailable: 1
|
|
maxSurge: 1
|
|
selector:
|
|
matchLabels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: controller
|
|
template:
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: controller
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
spec:
|
|
serviceAccountName: ingress-nginx
|
|
containers:
|
|
- name: controller
|
|
image: us.gcr.io/k8s-artifacts-prod/ingress-nginx/controller:v0.34.1@sha256:0e072dddd1f7f8fc8909a2ca6f65e76c5f0d2fcfb8be47935ae3457e8bbceb20
|
|
imagePullPolicy: IfNotPresent
|
|
lifecycle:
|
|
preStop:
|
|
exec:
|
|
command:
|
|
- /wait-shutdown
|
|
args:
|
|
- /nginx-ingress-controller
|
|
- --configmap=$(POD_NAMESPACE)/nginx-load-balancer-conf
|
|
- --report-node-internal-ip-address
|
|
- --tcp-services-configmap=$(POD_NAMESPACE)/tcp-services
|
|
- --udp-services-configmap=$(POD_NAMESPACE)/udp-services
|
|
- --validating-webhook=:8443
|
|
- --validating-webhook-certificate=/usr/local/certificates/cert
|
|
- --validating-webhook-key=/usr/local/certificates/key
|
|
securityContext:
|
|
capabilities:
|
|
drop:
|
|
- ALL
|
|
add:
|
|
- NET_BIND_SERVICE
|
|
runAsUser: 101
|
|
allowPrivilegeEscalation: true
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
livenessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 10254
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10
|
|
periodSeconds: 10
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
readinessProbe:
|
|
httpGet:
|
|
path: /healthz
|
|
port: 10254
|
|
scheme: HTTP
|
|
initialDelaySeconds: 10
|
|
timeoutSeconds: 1
|
|
successThreshold: 1
|
|
failureThreshold: 3
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
protocol: TCP
|
|
hostPort: 80
|
|
- name: https
|
|
containerPort: 443
|
|
protocol: TCP
|
|
hostPort: 443
|
|
- name: webhook
|
|
containerPort: 8443
|
|
protocol: TCP
|
|
volumeMounts:
|
|
- name: webhook-cert
|
|
mountPath: /usr/local/certificates/
|
|
readOnly: true
|
|
resources:
|
|
requests:
|
|
cpu: 100m
|
|
memory: 90Mi
|
|
volumes:
|
|
- name: webhook-cert
|
|
secret:
|
|
secretName: ingress-nginx-admission
|
|
|
|
---
|
|
|
|
apiVersion: admissionregistration.k8s.io/v1beta1
|
|
kind: ValidatingWebhookConfiguration
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
name: ingress-nginx-admission
|
|
namespace: kube-system
|
|
webhooks:
|
|
- name: validate.nginx.ingress.kubernetes.io
|
|
rules:
|
|
- apiGroups:
|
|
- extensions
|
|
- networking.k8s.io
|
|
apiVersions:
|
|
- v1beta1
|
|
operations:
|
|
- CREATE
|
|
- UPDATE
|
|
resources:
|
|
- ingresses
|
|
failurePolicy: Fail
|
|
clientConfig:
|
|
service:
|
|
namespace: kube-system
|
|
name: ingress-nginx-controller-admission
|
|
path: /extensions/v1beta1/ingresses
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: ingress-nginx-admission
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
namespace: kube-system
|
|
rules:
|
|
- apiGroups:
|
|
- admissionregistration.k8s.io
|
|
resources:
|
|
- validatingwebhookconfigurations
|
|
verbs:
|
|
- get
|
|
- update
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: ingress-nginx-admission
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
namespace: kube-system
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: ingress-nginx-admission
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: ingress-nginx-admission
|
|
namespace: kube-system
|
|
---
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: ingress-nginx-admission-create
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
namespace: kube-system
|
|
spec:
|
|
template:
|
|
metadata:
|
|
name: ingress-nginx-admission-create
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
spec:
|
|
containers:
|
|
- name: create
|
|
image: jettech/kube-webhook-certgen:v1.2.2
|
|
imagePullPolicy: IfNotPresent
|
|
args:
|
|
- create
|
|
- --host=ingress-nginx-controller-admission,ingress-nginx-controller-admission.kube-system.svc
|
|
- --namespace=kube-system
|
|
- --secret-name=ingress-nginx-admission
|
|
restartPolicy: OnFailure
|
|
serviceAccountName: ingress-nginx-admission
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 2000
|
|
|
|
---
|
|
|
|
apiVersion: batch/v1
|
|
kind: Job
|
|
metadata:
|
|
name: ingress-nginx-admission-patch
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
namespace: kube-system
|
|
spec:
|
|
template:
|
|
metadata:
|
|
name: ingress-nginx-admission-patch
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: admission-webhook
|
|
spec:
|
|
containers:
|
|
- name: patch
|
|
image: jettech/kube-webhook-certgen:v1.2.2
|
|
imagePullPolicy:
|
|
args:
|
|
- patch
|
|
- --webhook-name=ingress-nginx-admission
|
|
- --namespace=kube-system
|
|
- --patch-mutating=false
|
|
- --secret-name=ingress-nginx-admission
|
|
- --patch-failure-policy=Fail
|
|
restartPolicy: OnFailure
|
|
serviceAccountName: ingress-nginx-admission
|
|
securityContext:
|
|
runAsNonRoot: true
|
|
runAsUser: 2000
|
|
---
|
|
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
labels:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: controller
|
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
name: ingress-nginx-controller-admission
|
|
namespace: kube-system
|
|
spec:
|
|
ports:
|
|
- name: https-webhook
|
|
port: 443
|
|
targetPort: webhook
|
|
selector:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: controller
|