mirror of
https://github.com/notherealmarco/coredns-deployment.git
synced 2025-03-14 06:06:16 +01:00
Drop unneeded capabilities, make container read-only (#76)
* Run CoreDNS in Docker only with CAP_NET_BIND_SERVICE, drop all other (root) privileges. Run filesystem of container and config in read-only mode. * Run CoreDNS in Kubernetes only with CAP_NET_BIND_SERVICE, drop all other (root) privileges. Run filesystem of container and config in read-only mode.
This commit is contained in:
parent
d1771c8cde
commit
aba0245609
2 changed files with 15 additions and 1 deletions
|
@ -9,7 +9,12 @@ services:
|
|||
- "53:53/tcp"
|
||||
- "9153:9153/tcp"
|
||||
volumes:
|
||||
- coredns:/data
|
||||
- coredns:/data:ro
|
||||
cap_drop:
|
||||
- ALL
|
||||
cap_add:
|
||||
- NET_BIND_SERVICE
|
||||
read_only: true
|
||||
deploy:
|
||||
mode: global
|
||||
placement:
|
||||
|
|
|
@ -94,6 +94,7 @@ spec:
|
|||
volumeMounts:
|
||||
- name: config-volume
|
||||
mountPath: /etc/coredns
|
||||
readOnly: true
|
||||
ports:
|
||||
- containerPort: 53
|
||||
name: dns
|
||||
|
@ -104,6 +105,14 @@ spec:
|
|||
- containerPort: 9153
|
||||
name: metrics
|
||||
protocol: TCP
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
add:
|
||||
- NET_BIND_SERVICE
|
||||
drop:
|
||||
- all
|
||||
readOnlyRootFilesystem: true
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /health
|
||||
|
|
Loading…
Reference in a new issue