Change daemonset definition to be more secure

Signed-off-by: Ángel Barrera Sánchez <angel@sighup.io>
This commit is contained in:
Ángel Barrera Sánchez
2019-11-14 17:19:42 +01:00
parent f99ba84d17
commit 4dab241ff6
2 changed files with 53 additions and 13 deletions
+30 -4
View File
@@ -25,13 +25,17 @@ spec:
app: goldpinger
spec:
serviceAccount: "goldpinger-serviceaccount"
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
containers:
- name: goldpinger
env:
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "80"
value: "8080"
# injecting real hostname will make for easier to understand graphs/metrics
- name: HOSTNAME
valueFrom:
@@ -42,10 +46,32 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: "docker.io/bloomberg/goldpinger:1.4.0"
image: "docker.io/bloomberg/goldpinger:2.0.0"
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
resources:
limits:
memory: 80Mi
requests:
cpu: 1m
memory: 40Mi
ports:
- containerPort: 80
- containerPort: 8080
name: http
readinessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 20
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: 8080
initialDelaySeconds: 20
periodSeconds: 5
---
apiVersion: v1
kind: Service
@@ -57,7 +83,7 @@ metadata:
spec:
type: NodePort
ports:
- port: 80
- port: 8080
nodePort: 30080
name: http
selector:
+23 -9
View File
@@ -5,20 +5,24 @@ metadata:
name: goldpinger
labels:
app: goldpinger
version: "1.5.0"
version: "2.0.0"
spec:
updateStrategy:
type: RollingUpdate
selector:
matchLabels:
app: goldpinger
version: "1.5.0"
version: "2.0.0"
template:
metadata:
labels:
app: goldpinger
version: "1.5.0"
version: "2.0.0"
spec:
securityContext:
runAsNonRoot: true
runAsUser: 1000
fsGroup: 2000
# if you'd like to use a secret to inject a kubeconfig, you can do it like this
volumes:
- name: kubeconfig
@@ -30,7 +34,7 @@ spec:
- name: HOST
value: "0.0.0.0"
- name: PORT
value: "80"
value: "8080"
# kubeconfig needs to match the location of what's injected in the secret
# if not specified goldpinger will default to using in-cluster config
- name: KUBECONFIG
@@ -48,20 +52,30 @@ spec:
valueFrom:
fieldRef:
fieldPath: status.podIP
image: "docker.io/bloomberg/goldpinger:1.5.0"
image: "docker.io/bloomberg/goldpinger:2.0.0"
imagePullPolicy: Always
securityContext:
allowPrivilegeEscalation: false
readOnlyRootFilesystem: true
resources:
limits:
memory: 80Mi
requests:
cpu: 1m
memory: 40Mi
ports:
- containerPort: 80
- containerPort: 8080
name: http
readinessProbe:
httpGet:
path: /healthz
port: 80
port: 8080
initialDelaySeconds: 20
periodSeconds: 5
livenessProbe:
httpGet:
path: /healthz
port: 80
port: 8080
initialDelaySeconds: 20
periodSeconds: 5
volumeMounts:
@@ -78,7 +92,7 @@ metadata:
spec:
type: NodePort
ports:
- port: 80
- port: 8080
nodePort: 30080
name: http
selector: