proxy-pool/deploy/kubernetes/base/controller.yaml

93 lines
3.2 KiB
YAML

apiVersion: apps/v1
kind: Deployment
metadata:
name: proxy-controller
namespace: proxy-pool
labels: {app.kubernetes.io/name: proxy-controller, app.kubernetes.io/part-of: proxy-pool}
spec:
replicas: 3
minReadySeconds: 10
revisionHistoryLimit: 3
strategy:
type: RollingUpdate
rollingUpdate: {maxUnavailable: 1, maxSurge: 1}
selector:
matchLabels: {app.kubernetes.io/name: proxy-controller}
template:
metadata:
labels: {app.kubernetes.io/name: proxy-controller, app.kubernetes.io/part-of: proxy-pool}
annotations: {prometheus.io/scrape: "true", prometheus.io/port: "9090", prometheus.io/path: /metrics}
spec:
serviceAccountName: proxy-pool
automountServiceAccountToken: false
terminationGracePeriodSeconds: 60
securityContext: {runAsNonRoot: true, seccompProfile: {type: RuntimeDefault}}
affinity:
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
topologyKey: kubernetes.io/hostname
labelSelector: {matchLabels: {app.kubernetes.io/name: proxy-controller}}
containers:
- name: controller
image: REGISTRY/proxy-pool:VERSION
imagePullPolicy: IfNotPresent
command: [proxy-controller]
env:
- {name: PROXY_POOL_CONFIG, value: /etc/proxy-pool/config.yaml}
envFrom:
- secretRef: {name: proxy-pool-secrets}
ports:
- {name: distribution, containerPort: 8081}
- {name: admin, containerPort: 8082}
- {name: control, containerPort: 8443}
- {name: metrics, containerPort: 9090}
readinessProbe:
httpGet: {path: /readyz, port: metrics}
periodSeconds: 5
timeoutSeconds: 2
failureThreshold: 3
livenessProbe:
httpGet: {path: /livez, port: metrics}
periodSeconds: 10
timeoutSeconds: 2
failureThreshold: 3
startupProbe:
httpGet: {path: /livez, port: metrics}
periodSeconds: 2
failureThreshold: 45
lifecycle:
preStop: {exec: {command: [sh, -c, "sleep 5"]}}
resources:
requests: {cpu: "1", memory: 1Gi}
limits: {cpu: "2", memory: 2Gi}
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
capabilities: {drop: [ALL]}
volumeMounts:
- {name: config, mountPath: /etc/proxy-pool, readOnly: true}
- {name: tmp, mountPath: /tmp}
volumes:
- name: config
configMap: {name: proxy-pool-config}
- name: tmp
emptyDir: {sizeLimit: 64Mi}
---
apiVersion: v1
kind: Service
metadata:
name: proxy-controller
namespace: proxy-pool
labels: {app.kubernetes.io/name: proxy-controller}
spec:
type: ClusterIP
selector: {app.kubernetes.io/name: proxy-controller}
ports:
- {name: distribution, port: 8081, targetPort: distribution}
- {name: admin, port: 8082, targetPort: admin}
- {name: control, port: 8443, targetPort: control}
- {name: metrics, port: 9090, targetPort: metrics}