271 lines
5.4 KiB
YAML
271 lines
5.4 KiB
YAML
apiVersion: v1
|
|
kind: Namespace
|
|
metadata:
|
|
name: kiamol-ingress-nginx
|
|
labels:
|
|
kiamol: ch21
|
|
---
|
|
apiVersion: v1
|
|
kind: ConfigMap
|
|
metadata:
|
|
name: ingress-nginx-controller
|
|
namespace: kiamol-ingress-nginx
|
|
data:
|
|
http-snippet: |
|
|
proxy_cache_path /tmp/nginx-cache levels=1:2 keys_zone=static-cache:2m max_size=100m inactive=7d use_temp_path=off;
|
|
proxy_cache_key $scheme$proxy_host$request_uri;
|
|
proxy_cache_lock on;
|
|
proxy_cache_use_stale updating;
|
|
---
|
|
apiVersion: v1
|
|
kind: Service
|
|
metadata:
|
|
name: ingress-nginx-controller
|
|
namespace: kiamol-ingress-nginx
|
|
spec:
|
|
type: LoadBalancer
|
|
ports:
|
|
- name: http
|
|
port: 80
|
|
targetPort: http
|
|
- name: https
|
|
port: 443
|
|
targetPort: https
|
|
selector:
|
|
app.kubernetes.io/name: ingress-nginx
|
|
app.kubernetes.io/instance: ingress-nginx
|
|
app.kubernetes.io/component: controller
|
|
---
|
|
apiVersion: apps/v1
|
|
kind: Deployment
|
|
metadata:
|
|
name: ingress-nginx-controller
|
|
namespace: kiamol-ingress-nginx
|
|
spec:
|
|
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
|
|
spec:
|
|
containers:
|
|
- name: controller
|
|
image: quay.io/kubernetes-ingress-controller/nginx-ingress-controller:0.33.0
|
|
args:
|
|
- /nginx-ingress-controller
|
|
- --publish-service=kiamol-ingress-nginx/ingress-nginx-controller
|
|
- --election-id=ingress-controller-leader
|
|
- --ingress-class=nginx
|
|
- --configmap=kiamol-ingress-nginx/ingress-nginx-controller
|
|
securityContext:
|
|
runAsUser: 101
|
|
allowPrivilegeEscalation: true
|
|
env:
|
|
- name: POD_NAME
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.name
|
|
- name: POD_NAMESPACE
|
|
valueFrom:
|
|
fieldRef:
|
|
fieldPath: metadata.namespace
|
|
ports:
|
|
- name: http
|
|
containerPort: 80
|
|
protocol: TCP
|
|
- name: https
|
|
containerPort: 443
|
|
protocol: TCP
|
|
serviceAccountName: ingress-nginx
|
|
---
|
|
# RBAC configuration
|
|
apiVersion: v1
|
|
kind: ServiceAccount
|
|
metadata:
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRole
|
|
metadata:
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
rules:
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- configmaps
|
|
- endpoints
|
|
- nodes
|
|
- pods
|
|
- secrets
|
|
verbs:
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- nodes
|
|
verbs:
|
|
- get
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- services
|
|
verbs:
|
|
- get
|
|
- list
|
|
- update
|
|
- watch
|
|
- apiGroups:
|
|
- extensions
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingresses
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- events
|
|
verbs:
|
|
- create
|
|
- patch
|
|
- apiGroups:
|
|
- extensions
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingresses/status
|
|
verbs:
|
|
- update
|
|
- apiGroups:
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingressclasses
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: ClusterRoleBinding
|
|
metadata:
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: ClusterRole
|
|
name: ingress-nginx
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: Role
|
|
metadata:
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
rules:
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- namespaces
|
|
verbs:
|
|
- get
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- configmaps
|
|
- pods
|
|
- secrets
|
|
- endpoints
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- services
|
|
verbs:
|
|
- get
|
|
- list
|
|
- update
|
|
- watch
|
|
- apiGroups:
|
|
- extensions
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingresses
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- extensions
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingresses/status
|
|
verbs:
|
|
- update
|
|
- apiGroups:
|
|
- networking.k8s.io # k8s 1.14+
|
|
resources:
|
|
- ingressclasses
|
|
verbs:
|
|
- get
|
|
- list
|
|
- watch
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- configmaps
|
|
resourceNames:
|
|
- ingress-controller-leader-nginx
|
|
verbs:
|
|
- get
|
|
- update
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- configmaps
|
|
verbs:
|
|
- create
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- endpoints
|
|
verbs:
|
|
- create
|
|
- get
|
|
- update
|
|
- apiGroups:
|
|
- ''
|
|
resources:
|
|
- events
|
|
verbs:
|
|
- create
|
|
- patch
|
|
---
|
|
apiVersion: rbac.authorization.k8s.io/v1
|
|
kind: RoleBinding
|
|
metadata:
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx
|
|
roleRef:
|
|
apiGroup: rbac.authorization.k8s.io
|
|
kind: Role
|
|
name: ingress-nginx
|
|
subjects:
|
|
- kind: ServiceAccount
|
|
name: ingress-nginx
|
|
namespace: kiamol-ingress-nginx |