Skip to content

Commit

Permalink
Improve tutorial manifests
Browse files Browse the repository at this point in the history
The securityContext parameters should be available into the manifests.
Without it, testing the k8up on the MicroShift environment will raise
warnings:

    Warning: would violate PodSecurity "restricted:latest":
    seccompProfile (pod or container "mariadb" must set
    securityContext.seccompProfile.type to "RuntimeDefault" or "Localhost")

Also added the registry prefix to the images used in the tutorial, to
avoid complication when the runtime environment would not choose
docker.io as a default registry and removed namespace parameter from
secrets manifests, because other manifests in the tutorial does not have
such parameter (so if someone will use other namespace than 'default',
services/deployments will faile because of missing secrets).
  • Loading branch information
danpawlik committed Oct 30, 2023
1 parent 95398eb commit e720902
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 6 deletions.
12 changes: 11 additions & 1 deletion docs/modules/ROOT/examples/tutorial/mariadb/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,18 @@ spec:
annotations:
k8up.io/backupcommand: /bin/bash -c 'mysqldump -uroot -p"${MARIADB_ROOT_PASSWORD}" --all-databases'
spec:
securityContext:
runAsUser: 10002
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- image: mariadb:10.4
- image: docker.io/mariadb:10.4
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
name: mariadb
readinessProbe:
timeoutSeconds: 1
Expand Down
12 changes: 11 additions & 1 deletion docs/modules/ROOT/examples/tutorial/minio/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,22 @@ spec:
- name: data
persistentVolumeClaim:
claimName: minio-pvc
securityContext:
runAsUser: 10002
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- name: minio
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumeMounts:
- name: data
mountPath: "/data"
image: minio/minio
image: docker.io/minio/minio
args:
- server
- /data
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Secret
metadata:
name: backup-repo
namespace: default
type: Opaque
stringData:
password: p@ssw0rd
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Secret
metadata:
name: mariadb-pass
namespace: default
type: Opaque
stringData:
password: ola0thai0eixieCie6Yahcooz3doojee
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: v1
kind: Secret
metadata:
name: minio-credentials
namespace: default
type: Opaque
stringData:
username: minio
Expand Down
12 changes: 11 additions & 1 deletion docs/modules/ROOT/examples/tutorial/wordpress/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,18 @@ spec:
app: wordpress
tier: frontend
spec:
securityContext:
runAsUser: 10002
runAsNonRoot: true
seccompProfile:
type: RuntimeDefault
containers:
- image: wordpress:5.4-apache
- image: docker.io/wordpress:5.4-apache
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
name: wordpress
env:
- name: WORDPRESS_DB_HOST
Expand Down

0 comments on commit e720902

Please sign in to comment.