PKI and secrets
furyctl can create the certificates and the random secrets that a configuration file needs.
Create the PKI for on-premises and immutable clusters
The OnPremises and the Immutable kinds need a set of certificate authorities and certificate
files to work as a prerequisite. Both for the Kubernetes control plane and for the etcd database.
The OnPremises kind reads the folder that holds them from .spec.kubernetes.pkiFolder, and the
Immutable kind from .spec.kubernetes.pkiPath.
furyctl provides a command that allows the creation of this PKI:
furyctl create pki
The command supports some additional options, like --etcd to create only the PKI for etcd, or creating the files in a different path.
See all the additional options with the --help flag:
furyctl create pki --help
Create the secrets that the configuration file needs
Some fields of the cluster configuration file need a secret. For example, Pomerium needs four
secrets when the auth module type is sso. Gangplank needs a client secret and a session security
key.
This step is optional. You can write your own secrets in these fields, or let furyctl create
random secrets for you.
Do not write a secret directly in furyctl.yaml. Keep each secret in a separate file, or in an
environment variable, and write a reference to it in the field:
{file://<path>}reads the value from a file.{env://<name>}reads the value from an environment variable, for example a variable that your secret manager sets.
spec:
distribution:
modules:
auth:
pomerium:
secrets:
COOKIE_SECRET: "{file://./secrets/pomerium/cookie-secret}"
IDP_CLIENT_SECRET: "{env://POMERIUM_IDP_CLIENT_SECRET}"
Encrypt the secret files, for example with SOPS or
git-crypt, and decrypt them only on the machine that runs
furyctl. Then you can keep furyctl.yaml and the encrypted files in a git repository. See
Variable interpolation.
To let furyctl create the random secrets, run:
furyctl create secrets
The command writes one file for each secret, in ./secrets/<component>/, and prints the fields to
add to your furyctl.yaml. The fields read the files with the
{file://<path>} notation.
With the --update-config flag furyctl writes those fields in the configuration file for you. It
edits only the lines of those fields. Thus each comment, each empty line and each multi-line value,
for example a certificate in oidcTrustedCA, stay as they are. furyctl writes the configuration
file one time, and a configuration file that is a symbolic link keeps the link.
A field that already holds a value stays as it is, and furyctl writes no secret for it: the cluster can run with that value, and a new one would be a different secret. The command names each such field. To get a new value, take the field out of the configuration file and run the command again.
On the OnPremises and Immutable kinds the command also asks whether the cluster encrypts the
secrets of etcd at rest. With an answer of yes, furyctl writes an
EncryptionConfiguration object with a new secretbox key, and the
spec.kubernetes.advanced.encryption.configuration field reads that file. The command asks nothing
with the --no-tty flag. To write that configuration with no question, name the component:
furyctl create secrets etcd-encryption
The API server reads the encryption at rest configuration when it starts. To give it the new
configuration, apply the kubernetes phase with furyctl apply --phase kubernetes. The playbooks
write the file to each control plane node and reconfigure the API server.
The secrets that etcd holds stay in clear text until something writes them again. Write again only the secrets that you must: a command that writes each secret of the cluster also writes the secrets of the infrastructure and of the plugins, and a tool such as kapp or a GitOps controller owns those.
Keep the file safe: without it, etcd holds secrets that nothing can read. A new key needs the old one in the same file until each secret is written again, thus never replace the key of a cluster that runs.
With no argument, furyctl creates only the secrets that your configuration file needs and that your cluster can hold. The kind of the cluster and the version of the distribution decide which fields the cluster has, thus an older version of the distribution gets fewer secrets. If you name a component that your cluster cannot hold, furyctl creates the secrets of the other names and then stops with an error.
furyctl reads those fields from the schema of the distribution, thus the command downloads it the
first time for each version. Use --distro-location to read it from a local copy. With no
configuration file furyctl reads no schema, and creates the secrets of every component.
Name the components to create only some of them:
furyctl create secrets pomerium gangplank
A file that is already there keeps its value. Thus you can run the command again after you add a module to the configuration file. The secrets that are already there stay the same. A path that holds no secret that furyctl can read is a fault: a folder, a file with no value in it, or a file that furyctl has no permissions for. furyctl creates the other secrets, names that path, and the run ends with an error. It writes no reference to that path, and it changes nothing in it.
The command stops when it cannot read the value of a field, for example when a {file://} path is
not there or an environment variable holds no value. It then names each such field. furyctl cannot
tell an empty field from a field that holds a secret that it cannot see, and a new value would be a
second secret.
See all the additional options with the --help flag:
furyctl create secrets --help