Add a Cluster
Pick the tab for your infrastructure.
- Kubernetes
- Linux
Before you begin
This step requires:
- A Kubernetes cluster with cluster admin permissions
kubectlconfigured to access your cluster
If you don't have a Kubernetes cluster, you can create a local cluster using kind:
kind create cluster --name "cluster-1"
Bootstrap the cluster
Run the following command to bootstrap your cluster with Defakto:
defakto cluster add "cluster-1" --trust-domain "example.com" --platform k8s \
--kube-context $(kubectl config current-context)
If you have more than one kubeconfig context, defakto-cli will prompt you to pick one interactively. Pass --kube-context <name> to skip the prompt, as shown above.
Once complete, the above step will have done the following:
- Registered your Kubernetes cluster with Defakto.
- Within your cluster, created a new namespace (
spirl-system) to run the required Defakto components. - Deployed the following Defakto components:
- The admission controller, which automatically exposes the Defakto agent to your pods.
- The CSI Driver, which facilitates injection of the SPIFFE Workload API to your workloads.
- The Agent, which runs alongside your workloads to grant them SPIFFE SVIDs.
That's it! Defakto is now running. Any pod you deploy with the label k8s.spirl.com/spiffe-csi: enabled will have a SPIFFE Workload API socket automatically injected, with an X.509-SVID and JWT-SVID made available. To see it in action, continue to deploy a SPIFFE demo app.
Optional: Repeat the above command with a different cluster name and kubectl context to add more Kubernetes clusters to the example.com trust domain.
Before you begin
This step requires:
- A Linux VM with
sudoaccess systemdrunning on the VM- ssh access to the node or the ability to download files from a URL, write files to disk, and install a package.
The installed agent runs as a dedicated, non-root spirl user.
Bootstrap the Cluster
Run the following command to register a node-group (cluster of type Linux) with Defakto and generate a configuration file and private key that will be used to deploy the agent
defakto node-group add my-linux-cluster --trust-domain example.com
This will generate two files:
Successfully added node group "my-linux-cluster" to trust domain "example.com"
Node Config ID: cv-xxxxxxxxxxxx
Agent configuration file written to: my-linux-cluster.cv-xxxxxxxxxxxx.agent-config.yaml
Agent node-group version key written to: my-linux-cluster.cv-xxxxxxxxxxxx.key.pem
Set a shell variable to the Node Config ID printed above, then create a directory called /etc/spirl and copy the files to the following paths on the VM with the exact names listed below:
$ NODE_CONFIG_ID=cv-xxxxxxxxxxxx
$ sudo mkdir /etc/spirl
$ sudo cp my-linux-cluster.$NODE_CONFIG_ID.agent-config.yaml /etc/spirl/agent-config.yaml
$ sudo cp my-linux-cluster.$NODE_CONFIG_ID.key.pem /etc/spirl/my-linux-cluster.$NODE_CONFIG_ID.key.pem
Please note that the files must be placed at those exact file paths.
Install the Agent on your VM
Download the package for your architecture:
# AMD64 Debian
curl -o spirl-agent.deb https://spirl-releases.s3.us-west-2.amazonaws.com/spirl-agent/0.48.2/spirl-agent_0.48.2_linux_amd64.deb
# AMD64 RPM
curl -o spirl-agent.rpm https://spirl-releases.s3.us-west-2.amazonaws.com/spirl-agent/0.48.2/spirl-agent_0.48.2_linux_amd64.rpm
# ARM64 Debian
curl -o spirl-agent.deb https://spirl-releases.s3.us-west-2.amazonaws.com/spirl-agent/0.48.2/spirl-agent_0.48.2_linux_arm64.deb
# ARM64 RPM
curl -o spirl-agent.rpm https://spirl-releases.s3.us-west-2.amazonaws.com/spirl-agent/0.48.2/spirl-agent_0.48.2_linux_arm64.rpmInstall the Debian package:
sudo dpkg -i spirl-agent.deb
Or the RPM package:
sudo yum install spirl-agent.rpm
Verify
Verify the service is running:
systemctl status spirl-agent.service
That's it! Defakto is now running. Your VM has a SPIFFE Workload API socket available at /var/run/spirl/sockets/agent.sock, serving an X.509-SVID and JWT-SVID to any workload on the node. To see it in action, continue to verify SVID issuance from the CLI.