liveBook · Manning

Group ownership

As explained in Kubernetes in Action, Second Edition

Group ownership is the association of a filesystem object with a Unix user group whose permissions can govern access to it.

Group ownership associates a filesystem object with a Unix user group. The group’s permissions can determine whether a process may read or write the object. This matters when a secret or configMap volume uses stricter permissions: the container process may need matching group ownership to access the mounted files. section 9.5.4

A file’s permissions apply separately to its owner, owning group, and other users. For example, mode 0640 allows the owner to read and write, the group to read, and others no access. In a Pod, set fsGroup in the securityContext to assign the mounted files to the process’s group. section 9.5.4

Allowing a container group to read a secret

A process running as envoy with group ID 101 can use a secret key whose mode is 0640 when the Pod sets fsGroup: 101. Before the setting, the file appears as root root; afterward, it appears as root envoy, so the group permission applies. section 9.5.4

apiVersion: v1
kind: Pod
metadata:
  name: kiada-ssl
spec:
  securityContext:      #1
    fsGroup: 101        #1
  volumes:
  ...

Use the Pod securityContext to set fsGroup for mounted secret or configMap files. section 9.5.4

How Kubernetes in Action, Second Edition covers it

How deep it goes
Explains Unix permission categories, restrictive modes, process groups, and fsGroup effects, but does not detail filesystem implementation internals.
Examples
Demonstrates mode 0640, an envoy process with group 101, and ownership changing from root root to root envoy.
What it assumes
Assumes basic containers and mounted volumes while introducing Unix permission categories, octal modes, groups, and fsGroup.
What you can do after
Operate/configure Pod volume access by choosing restrictive modes and setting fsGroup to a process’s group ID.
How it connects
Connects Unix file permissions with Kubernetes volumes, secrets, configMaps, securityContext, and container process identities.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Kubernetes in Action, Second Edition. The section links point to the parts of the book it draws on.