Note
The following documentation outlines how to deploy child clusters in an existing environment. See Deploying a new environment if deploying a new ArgoCD environment
- Create an application credential for the project the child cluster should be deployed in
- Ensure the project has enough quota for the cluster (RAM, CPU, instances etc)
- Provision a floating ip on your project for kubernetes API Server access
- (Optional) Provision a second floating IP for nginx ingress controller
To deploy a new child cluster on an existing environment follow these steps:
- Create a branch off of main
- Create a new folder under
clusters/<environment>/<cluster-name>
- Create a file in
clusters/<environment>/<cluster-name>/infra-values.yaml
- Populate the
infra-values.yaml
file with cluster-specific values for the chart incapi-infra
chart. - Create an age key for your new cluster to read any app-specific secrets
It could look like this:
openstack-cluster:
# defining the number of control-plane nodes
controlPlane:
machineCount: 3
# defining the number of worker nodes
nodeGroups:
- name: default-md-0
machineCount: 2
# worker node flavor
nodeGroupDefaults:
machineFlavor: l3.nano
# addon config for the cluster
# here we define an nginx ingress controller service
addons:
ingress:
enabled: true
nginx:
release:
values:
controller:
service:
# create a floatip for ingress on your project and put it here
loadBalancerIP: "130.xxx.yyy.zzz"
-
Create a new folder under
secrets/<environment>/<cluster-name>/infra
-
Create a new
.sops.yaml
file or copy one from another cluster from the same environment See Secrets for more information
In this file you will define age public keys for those who can decrypt/encrypt secrets belonging to that cluster
Note
Make sure that the management cluster for the same environment can decrypt those secrets
Make sure that the management cluster's public key is added to .sops.yaml
- Create file
api-server-fip.yaml
usingsops api-server-fip.yaml
. Add the following config:
openstack-cluster:
apiServer:
# create a floatip for accessing your K8s cluster and put it here
floatingIP: 130.xxx.yyy.zzz
This file contains the floating ip in which Kubernetes API server can be accessed
- Create file
app-creds.yaml
usingsops app-creds.yaml
. Add the following config
openstack-cluster:
# COPY YOUR OPENSTACK APP-CREDS INFO HERE
# IT SHOULD LOOK LIKE THIS
clouds:
openstack:
auth:
auth_url: ""
application_credential_id: ""
application_credential_secret: ""
# REMEMBER TO ADD THE PROJECT_ID MANUALLY
project_id: ""
region_name: ""
interface: ""
identity_api_version: ""
auth_type: ""
This file contains the credentials for creating and managing that cluster on openstack
Caution
Make sure the files in steps 7 and 8 has been encrypted using SOPS as outlined in the steps above before committing and pushing changes to your branch.
Note
The application credential must be created and valid for the project you want to created the child cluster in. It does not need to point to the same project as the management cluster.
-
Make a PR and get it reviewed.
-
Once merged, your new cluster should spin into life
-
Grab the kubeconfig from the management cluster
clusterctl get kubeconfig <environment>-<cluster-name>-cluster -n clusters > ~/.kube/config
-
(Optional) Run the script
./deploy-helm-secret.sh
to deploy your newly generated age key onto the cluster
- only need to run this if the charts you want to deploy require secrets
-
(On completing 12) Create the directory
./secrets/<environment>/<clustername>/apps
and create a.sops.yaml
file and add the public key of your generated age file -
(On completing 13) Add any other age keys that you want to grant access to these secrets
- (PROD/STAGING ONLY) - only add the relevant singular rotate keys
- (DEV ONLY) - add age keys of all cloud-team members - as it's easier to review and make changes
cd ./scripts; ./deploy-helm-secret.sh <path-to-age-key>
Note
See deploying apps to deploy ArgoCD and apps to new cluster
If you want to deploy apps to newly created cluster, you need to follow the steps in Deploying Apps
Once you complete these steps you will need to run ./scripts/deploy.sh <cluster-name> <environment>
on your cluster to spin up argocd and any apps you've configured to run