Commit 71017c3c authored by Geoff Simmons's avatar Geoff Simmons

Update deployment YAMLs to support TLS offload.

This introduces moving the port definitions for admin services to
a headless Service -- varnish-ingress-admin in admin-svc.yaml. Services
that implement Ingress with Varnish are identified by this Service:
label app=varnish-ingress and at least the port named varnishadm,
possibly also the admin ports for the haproxy offloader (dataplane
and faccess).
parent da2f29b8
...@@ -7,3 +7,4 @@ metadata: ...@@ -7,3 +7,4 @@ metadata:
type: Opaque type: Opaque
data: data:
admin: XGASQn0dd/oEsWh5WMXUpmKAKNZYnQGsHSmO/nHkv1w= admin: XGASQn0dd/oEsWh5WMXUpmKAKNZYnQGsHSmO/nHkv1w=
dataplaneapi: ZTI0YmIzMTItY2IyMS00NmQ2LWFhZWMtOGFlNjc2ZjA2ZmVhCg==
apiVersion: v1
kind: Service
metadata:
name: varnish-ingress-admin
labels:
app: varnish-ingress
spec:
clusterIP: None
ports:
- port: 6081
targetPort: 6081
protocol: TCP
name: varnishadm
- port: 5555
targetPort: 5555
protocol: TCP
name: dataplane
- port: 5556
targetPort: 5556
protocol: TCP
name: faccess
- port: 9443
targetPort: 9443
protocol: TCP
name: stats
selector:
app: varnish-ingress
...@@ -2,6 +2,10 @@ ...@@ -2,6 +2,10 @@
kubectl apply -f adm-secret.yaml kubectl apply -f adm-secret.yaml
kubectl apply -f tls-cert-secret.yaml
kubectl apply -f varnish.yaml kubectl apply -f varnish.yaml
kubectl apply -f admin-svc.yaml
kubectl apply -f nodeport.yaml kubectl apply -f nodeport.yaml
...@@ -7,16 +7,16 @@ metadata: ...@@ -7,16 +7,16 @@ metadata:
annotations: annotations:
service.alpha.kubernetes.io/tolerate-unready-endpoints: "true" service.alpha.kubernetes.io/tolerate-unready-endpoints: "true"
spec: spec:
type: NodePort type: NodePort
ports: ports:
- port: 6081
targetPort: 6081
protocol: TCP
name: varnishadm
- port: 80 - port: 80
targetPort: 80 targetPort: 80
protocol: TCP protocol: TCP
name: http name: http
- port: 443
targetPort: 443
protocol: TCP
name: tls
selector: selector:
app: varnish-ingress app: varnish-ingress
publishNotReadyAddresses: true publishNotReadyAddresses: true
...@@ -20,6 +20,17 @@ rules: ...@@ -20,6 +20,17 @@ rules:
- get - get
- list - list
- watch - watch
- apiGroups:
- ""
resources:
- secrets
resourceNames:
- tls-cert
verbs:
- get
- list
- watch
- update
- apiGroups: - apiGroups:
- "" - ""
resources: resources:
......
apiVersion: v1
kind: Secret
metadata:
name: tls-cert
labels:
app: varnish-ingress
type: Opaque
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
kubectl delete -f nodeport.yaml kubectl delete -f nodeport.yaml
kubectl delete -f admin-svc.yaml
kubectl delete -f varnish.yaml kubectl delete -f varnish.yaml
kubectl delete -f tls-cert-secret.yaml
kubectl delete -f adm-secret.yaml kubectl delete -f adm-secret.yaml
echo Waiting until varnish-ingress Pods are deleted echo Waiting until varnish-ingress Pods are deleted
......
...@@ -12,6 +12,10 @@ spec: ...@@ -12,6 +12,10 @@ spec:
labels: labels:
app: varnish-ingress app: varnish-ingress
spec: spec:
securityContext:
# group varnish in the varnish and haproxy containers
# The varnish and haproxy users belong to this group.
fsGroup: 998
containers: containers:
- image: varnish-ingress/varnish - image: varnish-ingress/varnish
imagePullPolicy: IfNotPresent imagePullPolicy: IfNotPresent
...@@ -21,14 +25,14 @@ spec: ...@@ -21,14 +25,14 @@ spec:
containerPort: 80 containerPort: 80
- name: k8s - name: k8s
containerPort: 8080 containerPort: 8080
- name: varnishadm
containerPort: 6081
volumeMounts: volumeMounts:
- name: adm-secret - name: adm-secret
mountPath: "/var/run/varnish" mountPath: "/var/run/varnish"
readOnly: true readOnly: true
- name: varnish-home - name: varnish-home
mountPath: "/var/run/varnish-home" mountPath: "/var/run/varnish-home"
- name: offload
mountPath: "/var/run/offload"
livenessProbe: livenessProbe:
exec: exec:
command: command:
...@@ -43,6 +47,37 @@ spec: ...@@ -43,6 +47,37 @@ spec:
args: args:
- -n - -n
- /var/run/varnish-home - /var/run/varnish-home
- image: varnish-ingress/haproxy
imagePullPolicy: IfNotPresent
name: varnish-ingress-offloader
ports:
- name: tls
containerPort: 443
- name: k8s
containerPort: 8443
volumeMounts:
- name: tls-cert
mountPath: "/etc/ssl/private"
readOnly: true
- name: offload
mountPath: "/var/run/offload"
env:
- name: SECRET_DATAPLANEAPI
valueFrom:
secretKeyRef:
name: adm-secret
key: dataplaneapi
livenessProbe:
exec:
command:
- /usr/bin/pgrep
- -P
- "0"
- haproxy
readinessProbe:
httpGet:
path: /healthz
port: k8s
volumes: volumes:
- name: adm-secret - name: adm-secret
secret: secret:
...@@ -50,6 +85,12 @@ spec: ...@@ -50,6 +85,12 @@ spec:
items: items:
- key: admin - key: admin
path: _.secret path: _.secret
- name: tls-cert
secret:
secretName: tls-cert
defaultMode: 0440
- name: varnish-home - name: varnish-home
emptyDir: emptyDir:
medium: "Memory" medium: "Memory"
- name: offload
emptyDir: {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment