Set up the cluster¶
Create a kind cluster¶
A kind config is included to deploy the development cluster.
Running the following command will set up the cluster:
make cluster
This creates a cluster called dyff using the
cluster/kind/config.yaml config.
The following output will be displayed to notify that the cluster has been created:
$ make cluster
Creating cluster "dyff" ...
✓ Ensuring node image (kindest/node:v1.27.3) 🖼
✓ Preparing nodes 📦
✓ Writing configuration 📜
✓ Starting control-plane 🕹️
✓ Installing CNI 🔌
✓ Installing StorageClass 💾
Set kubectl context to "kind-dyff"
You can now use your cluster with:
kubectl cluster-info --context kind-dyff
Thanks for using kind! 😊
Configure access credentials for external services¶
To use Dyff functionality that requires authenticated access to external services, you need to provide your credentials at deployment time. These are set using Tofu variables.
Note
These variables must be set before deploying Dyff onto the cluster. If you change the variable values, you may need to manually restart the k8s components that consume their values.
Tofu variables can be set either by creating a config.tfvars file in the dev-environment root directory, or by setting the environment variables TF_VAR_variable_name.
Warning
Make sure to .gitignore any files in the repository tree where you store secrets!
The config.tfvars file is ignored by default.
These are the variables you can set:
huggingface_access_token– A token for the HuggingFace platform withREADpermission. Used for pulling inference models.
For example, create a config.tfvars file with the following content:
huggingface_access_token = "hf_your_token_here"
Deploy cluster applications¶
Dyff uses Open Tofu for managing its infrastructure.
After installing Open Tofu, initialize the dev-environment deployment by running:
tofu init
Now we can deploy Dyff to the cluster environment:
make apply
Various credentials are output to a credentials.yaml file in the
project root.
Create an Admin token for the cluster¶
See Account management for more information about account management.
Log in to a dyff-api pod¶
Use kubectl to get the name of a dyff-api pod. In the dev-environment configuration, these pods run in the dyff namespace.
kubectl get pods -n dyff | grep '^dyff-api'
Now, log in to one of the dyff-api pods with a command like this:
kubectl exec -it -n dyff dyff-api-6576fbf469-4vwkz -- bash -il
Create an admin account¶
In the dyff-api pod, run the following command:
$ python3 -m dyff.api.mgmt accounts create -n admin
created account: 'admin' (3076c505c36b46bdad1cf1abefaeb580)
Note
The account ID will be different in your installation.
Create an Admin token for the admin account¶
In the dyff-api pod, run the following command:
python3 -m dyff.api.mgmt tokens create -t account -i 3076c505c36b46bdad1cf1abefaeb580 --role Admin
Note
Use the account ID from the previous step.
Store the token locally¶
For convenience, we recommend storing the output of the previous command in a local file. For example, in ~/.dyff/accounts/dev-admin.
Troubleshooting¶
if you encounter the message
AttributeError: module 'bcrypt' has no attribute '__about__', this is a log message that can be safely ignored.
Warning
This section is never complete. You can help us by expanding it.