如何轻松配置与使用阿里云K8s私有Ingress Controller
最编程
2024-07-30 07:57:45
...
#tolerations:
# - key: node-role.kubernetes.io/master
# effect: NoSchedule
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchExpressions:
- key: app
operator: In
values:
- ingress-nginx
topologyKey: "kubernetes.io/hostname"
#use default serviceAccountName
serviceAccountName: nginx-ingress-controller
initContainers:
- name: init-sysctl
image: registry-vpc.cn-hongkong.aliyuncs.com/acs/busybox:latest
command:
- /bin/sh
- -c
- |
sysctl -w net.core.somaxconn=65535
sysctl -w net.ipv4.ip_local_port_range="1024 65535"
sysctl -w fs.file-max=1048576
sysctl -w fs.inotify.max_user_instances=16384
sysctl -w fs.inotify.max_user_watches=524288
sysctl -w fs.inotify.max_queued_events=16384
securityContext:
privileged: true
containers:
- name: nginx-ingress-controller
image: registry-vpc.cn-hongkong.aliyuncs.com/acs/aliyun-ingress-controller:v0.22.0.5-552e0db-aliyun
args:
- /nginx-ingress-controller
- --configmap=$(POD_NAMESPACE)/private-nginx-configuration
- --tcp-services-configmap=$(POD_NAMESPACE)/private-tcp-services
- --udp-services-configmap=$(POD_NAMESPACE)/private-udp-services
- --annotations-prefix=nginx.ingress.kubernetes.io
- --publish-service=$(POD_NAMESPACE)/private-nginx-ingress-lb
- --ingress-class=private #自定义名
- --v=2
env:
- name: POD_NAME
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: POD_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
ports:
- name: http
containerPort: 80
- name: https
containerPort: 443
livenessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
initialDelaySeconds: 10
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
readinessProbe:
failureThreshold: 3
httpGet:
path: /healthz
port: 10254
scheme: HTTP
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
securityContext:
capabilities:
drop:
- ALL
add:
- NET_BIND_SERVICE
runAsUser: 33
volumeMounts:
- name: localtime
mountPath: /etc/localtime
readOnly: true
nodeSelector:
beta.kubernetes.io/os: linux
volumes:
- name: localtime
hostPath:
path: /etc/localtime
type: File