Skip to content

Podman Kube Play with --userns=auto - How to chown volumes? #22853

Description

@giuseppe

Discussed in #22848

Originally posted by MadSpindel May 30, 2024
I'm trying to understand how I can use rootfull containers with --userns=auto. I have a Kubernetes YAML spec generated with podman kube generate. The problem is, with the hostUsers set to false, the HUSER could change UID and then it will not be possible for the pod to change files in the volume mount. How can I update the Kubernetes YAML spec to tell Podman to chown (change owner) of the volume to new UID created with hostUsers: false?

My current Kubernetes YAML spec:

apiVersion: v1
kind: Pod
metadata:
  creationTimestamp: "2024-05-15T07:29:14Z"
  labels:
    app: dns-server-pod
  name: dns-server-pod
spec:
  hostUsers: false
  containers:
  - args:
    - /etc/dns
    env:
    - name: DNS_SERVER_DOMAIN
      value: dns-server
    image: docker.io/technitium/dns-server:latest
    name: dns-server
    ports:
    - containerPort: 53
      hostPort: 53
    - containerPort: 5380
      hostPort: 5380
    - containerPort: 53
      hostPort: 53
      protocol: UDP
    volumeMounts:
    - mountPath: /etc/dns
      name: technitium_config-pvc
  volumes:
  - name: technitium_config-pvc
    persistentVolumeClaim:
      claimName: technitium_config

```</div>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions