init-agent
by kcp
A Kubernetes agent to initialize newly created workspaces with Kubernetes objects.
About this chart
kcp Helm Chart - Init Agent
This Helm chart deploys an instance of the Init Agent.
Mode of Operation
The Init Agent connects to a variety of workspaces inside kcp. In each of them, the necessary RBAC needs to be provisioned for the agent to do its work.
To accomplish this, this Helm chart can be configured to output any combination of the following three targets:
"host"(default) – By default, the Helm chart will output the Deployment, ServiceAccount and RBAC to run the Init Agent on a Kubernetes cluster. For this to work, you need to provide Helm with a kubeconfig for that cluster.configcluster– In this mode, the Helm chart outputs the RBAC necessary for the agent to read and process itsInitTargetobjects. This is meant to be installed into the workspace that is configured via.configWorkspacewhen installing the chart in default mode (above). This needs to be done once, using a kubeconfig for Helm that points to the config workspace of choice in kcp.wstcluster– This mode outputs the necessary RBAC to read and initializeWorkspaceTypes. This needs to be installed into each workspace whereWorkspaceTypeobjects exist that are referenced by anInitTarget.For this to work, you need to provide Helm with a kubeconfig that points to the effective workspace.
To toggle between these, use the Helm variable targets and set it to any combination of the targets:
helm install init-agent kcp/init-agent \
--set "targets=[configcluster, host]" \
--values myvalues.yaml
If you do not specify targets, the default is [host].
Usage
Helm must be installed to use the charts. Please refer to Helm's documentation to get started.
Once Helm has been set up correctly, add the repo as follows:
helm repo add kcp https://kcp-dev.github.io/helm-charts
If you had already added this repo earlier, run helm repo update to retrieve the latest versions
of the packages. You can then run helm search repo kcp to see the charts.
To install the kcp chart:
helm upgrade --install my-init-agent kcp/init-agent --values ./myvalues.yaml
NB: Remember to install the chart also into kcp. See mode of operation above.
To uninstall the release:
helm delete my-init-agent
Configuration
kcp kubeconfig
When installing the Init Agent, you need to provide it with the name of a Kubernetes Secret that
contains a kubeconfig to communicate with kcp (using the kcpKubeconfig variable of this chart).
Since the concrete way you choose to authenticate to kcp is up to you (the kcp-operator for example relies on client certificates), and the Helm chart can configure RBAC,
you need to configure in the Helm chart as what user the Init Agent is authenticated in kcp. The
default configuration assumes that the user is named kcp-init-agent:
configCluster:
rbacSubject:
kind: User
name: my-init-agent
Deploy init-agent with OpenTenant
Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has init-agent on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.
- Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
- Place the chartinit-agent is pinned at v0.3.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
- ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below opentenant validate opentenant.yaml terraform init && terraform apply