Skip to content

Commit 8c74286

Browse files
committed
docs: Extend build guidance with secrets
It's really worth emphasizing the authenticated-registry flow.
1 parent e70142d commit 8c74286

File tree

3 files changed

+58
-2
lines changed

3 files changed

+58
-2
lines changed

docs/src/SUMMARY.md

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
- [Building images](building/guidance.md)
1212
- [Users, groups, SSH keys](building/users-and-groups.md)
13+
- [Secrets](building/secrets.md)
1314

1415
# Using bootc
1516

docs/src/building/guidance.md

+6-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ and if you embed software in your derived image, the
5050
default would then be that that software is initially
5151
launched via a systemd unit.
5252

53-
```
54-
RUN dnf -y install postgresql
53+
```dockerfile
54+
RUN dnf -y install postgresql && dnf clean all
5555
```
5656

5757
Would typically also carry a systemd unit, and that
@@ -88,3 +88,7 @@ make in the container image to e.g. `/etc/postgresql.conf`
8888
will be applied on update, assuming it is not modified
8989
locally.
9090

91+
### Secrets
92+
93+
There is a dedicated document for [secrets](secrets.md),
94+
which is a special case of configuration.

docs/src/building/secrets.md

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
2+
# Secrets (e.g. container pull secrets)
3+
4+
To have `bootc` fetch updates from registry which requires authentication,
5+
you must include a pull secret in `/etc/ostree/auth.json`.
6+
7+
Another common case is to also fetch container images via
8+
`podman` or equivalent. There is a [pull request to add `/etc/containers/auth.json`](https://github.com/containers/image/pull/1746)
9+
which would be shared by the two stacks by default.
10+
11+
Regardless, injecting this data is a good example of a generic
12+
"secret". The bootc project does not currently include one
13+
single opinionated mechanism for secrets.
14+
15+
## Embedding in container build
16+
17+
This was mentioned above; you can include secrets in
18+
the container image if the registry server is suitably protected.
19+
20+
In some cases, embedding only "bootstrap" secrets into the container
21+
image is a viable pattern, especially alongside a mechanism for
22+
having a machine authenticate to a cluster. In this pattern,
23+
a provisioning tool (whether run as part of the host system
24+
or a container image) uses the bootstrap secret to lay down
25+
and keep updated other secrets (for example, SSH keys,
26+
certificates).
27+
28+
## Via cloud metadata
29+
30+
Most production IaaS systems support a "metadata server" or equivalent
31+
which can securely host secrets - particularly "bootstrap secrets".
32+
Your container image can include tooling such as `cloud-init`
33+
or `ignition` which fetches these secrets.
34+
35+
## Embedded in disk images
36+
37+
Another pattern is to embed bootstrap secrets only in disk images.
38+
For example, when generating a cloud disk image (AMI, OpenStack glance image, etc.)
39+
from an input container image, the disk image can contain secrets that
40+
are effectively machine-local state. Rotating them would
41+
require an additional management tool, or refreshing disk images.
42+
43+
## Injected via baremetal installers
44+
45+
It is common for installer tools to support injecting configuration
46+
which can commonly cover secrets like this.
47+
48+
## Injecting secrets via systemd credentials
49+
50+
The systemd project has documentation for [credentials](https://systemd.io/CREDENTIALS/)
51+
which applies in some deployment methodologies.

0 commit comments

Comments
 (0)