This guide demonstrates how to add DigitalOcean cloud credentials in Rancher and use them to provision an RKE2 cluster in DigitalOcean (DO).

Overview

DigitalOcean RKE2 Cluster in Rancher

Rancher simplifies the provisioning of downstream RKE2 clusters in DigitalOcean by integrating with the DigitalOcean API. By adding your DigitalOcean API token to Rancher, you can create a fully managed RKE2 cluster customized to your requirements.


Adding DigitalOcean Cloud Credentials

Prerequisites

  • A DigitalOcean account with an active API token.
  • Rancher installed and accessible.

Steps to Add DigitalOcean Cloud Credentials

  1. Log in to Rancher: Access your Rancher installation via its hostname (e.g., https://rancher.your-domain.com).

  2. Navigate to Cloud Credentials:

    • Open ☰ > Cluster Management.
    • Click Cloud Credentials.
  3. Add DigitalOcean Credentials:

    • Click Create.
    • Choose DigitalOcean as the cloud credential type.
    • Enter the required details:
      • API Token: Your DigitalOcean API token.
    • Click Create.

Provisioning the RKE2 Cluster

Steps to Provision an RKE2 Cluster in DigitalOcean

  1. Navigate to Cluster Management:

    • Open ☰ > Cluster Management.
    • Click Create on the Clusters page.
  2. Select RKE2 and DigitalOcean:

    • Set the toggle to RKE2/K3s.
    • Click DigitalOcean.
  3. Configure Cluster Details:

    • Enter a cluster name (e.g., rke2-do-cluster).
    • Select your previously added DigitalOcean cloud credentials.
  4. Machine Pool Configuration: Create two machine pools, following Rancher’s recommended cluster architecture:

    PoolRolesCountExample Droplet size
    cpetcd, Control Plane3s-4vcpu-8gb
    workersWorker2 or moresized for your workloads
    • Use 3 etcd nodes, not 2. With 2 etcd members a single failure loses quorum; 3 members tolerate one failure.
    • Rancher recommends at least two worker nodes and not combining the worker role with etcd or controlplane.
    • s-4vcpu-8gb matches the 4 CPU and 8 GB recommendation in the RKE2 requirements. Droplets use SSD storage, which etcd needs.
    • Pick an image for an OS that the RKE2 v1.36 support matrix certifies, such as Ubuntu 24.04 or 22.04.
    • Configure additional options as needed (SSH user, tags, monitoring).
  5. Cluster and Network Configuration:

    • Choose a Kubernetes version that your Rancher release supports. New RKE2 v1.36 clusters use Traefik as the default ingress controller, because the Kubernetes Ingress NGINX project was retired in March 2026 (see Ingress on RKE2).
    • Place the Droplets in a VPC so node traffic stays on the private network, and use a Cloud Firewall that allows the RKE2 ports between nodes and 443 outbound to Rancher.
  6. Review and Launch:

    • Review the configuration summary.
    • Click Create to start provisioning the cluster.

Testing and Validation

Accessing the Cluster

  1. Verify the cluster status in Rancher:

    • Navigate to Cluster Management and check the cluster state.
    • The status should show as Active once the provisioning is complete.
  2. Download the kubeconfig file:

    • Open the cluster from the Rancher home page.
    • Use Download KubeConfig in the cluster view, or open the built-in kubectl Shell.
  3. Access the cluster via kubectl:

    bash
    kubectl --kubeconfig=/path/to/kubeconfig get nodes

Testing Workloads

Deploy a test application to ensure the cluster is functional:

yaml
apiVersion: v1
kind: Pod
metadata:
  name: nginx-test
  namespace: default
spec:
  containers:
  - name: nginx
    image: nginx:stable
    ports:
    - containerPort: 80
bash
kubectl apply -f nginx-test.yaml
kubectl get pods

References