# How to Integrate with a DigitalOcean Container Registry DigitalOcean Kubernetes (DOKS) is a Kubernetes service with a fully managed control plane, high availability, and autoscaling. DOKS integrates with standard Kubernetes toolchains and DigitalOcean’s load balancers, volumes, CPU and GPU Droplets, API, and CLI. On DigitalOcean, you can integrate your Kubernetes cluster with a container registry via the control panel. This process requires you to have an existing container registry. If you don’t have an existing registry, first [create one](https://docs.digitalocean.com/products/container-registry/getting-started/quickstart/index.html.md#create-a-registry). To integrate a cluster, go to the [control panel](https://cloud.digitalocean.com/kubernetes/clusters) and click the Kubernetes cluster you want to integrate. Then, click the **Settings** tab, scroll down to the **DigitalOcean Container Registry Integration** section, and click **Edit** to the right. Check your container registry and click **Save** to confirm your change. For instructions on integrating a Kubernetes cluster and container registry via generated secrets or `kubectl`, see [our guide](https://docs.digitalocean.com/products/container-registry/how-to/use-registry-docker-kubernetes/index.html.md). ## Add a Container Registry to a Cluster Using Automation ## How to Add a Container Registry Using the DigitalOcean CLI 1. [Install `doctl`](https://docs.digitalocean.com/reference/doctl/how-to/install/index.html.md), the official DigitalOcean CLI. 2. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with `doctl`. 3. Use the token to grant `doctl` access to your DigitalOcean account. ```shell doctl auth init ``` 4. Finally, run `doctl kubernetes cluster registry add`. Basic usage looks like this, but you can [read the usage docs](https://docs.digitalocean.com/reference/doctl/reference/kubernetes/cluster/registry/add/index.html.md) for more details: ```shell doctl kubernetes cluster registry add [flags] ``` The following example adds container registry support to a cluster named `example-cluster`: ```shell doctl kubernetes cluster registry add example-cluster ``` ## How to Add a Container Registry Using the DigitalOcean API 1. [Create a personal access token](https://docs.digitalocean.com/reference/api/create-personal-access-token/index.html.md) and save it for use with the API. 2. Send a POST request to [`https://api.digitalocean.com/v2/kubernetes/registry`](https://docs.digitalocean.com/reference/api/reference/kubernetes/index.html.md#kubernetes_add_registry). ### cURL Using cURL: ```shell curl -X POST \ -H "Content-Type: application/json" \ -H "Authorization: Bearer $DIGITALOCEAN_TOKEN" \ -d '{"cluster_uuids": ["bd5f5959-5e1e-4205-a714-a914373942af", "50c2f44c-011d-493e-aee5-361a4a0d1844"]}' \ "https://api.digitalocean.com/v2/kubernetes/registry" ``` ### Go Using [Godo](https://github.com/digitalocean/godo), the official DigitalOcean API client for Go: ```go import ( "context" "os" "github.com/digitalocean/godo" ) func main() { token := os.Getenv("DIGITALOCEAN_TOKEN") client := godo.NewFromToken(token) ctx := context.TODO() _, err := client.Kubernetes.AddRegistry(ctx, &godo.KubernetesClusterRegistryRequest{ClusterUUIDs: []string{"bd5f5959-5e1e-4205-a714-a914373942af"}}) } ``` ### Python Using [PyDo](https://github.com/digitalocean/pydo), the official DigitalOcean API client for Python: ```python import os from pydo import Client client = Client(token=os.environ.get("DIGITALOCEAN_TOKEN")) req = { "cluster_uuids": [ "bd5f5959-5e1e-4205-a714-a914373942af", "50c2f44c-011d-493e-aee5-361a4a0d1844" ] } resp = client.kubernetes.add_registry(body=req) ```