How to Import a Managed Digital Ocean Kubernetes cluster in Rancher
Tags: kubernetes, digitalocean, devops
Published: 2019-07-23 17:29:16

---
title: How to Import a Managed Digital Ocean Kubernetes cluster in Rancher
published: true
tags: kubernetes, digitalocean, devops
canonical_url: https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/
---

_This post contains affiliate links to [Digital Ocean](https://m.do.co/c/f1bcc66950f3). It will get you $100 to test out the platform, and if at some point you start using it for real I will earn $25._

[Digital ocean](https://m.do.co/c/f1bcc66950f3) (DO) recently announced [their managed offering for kubernetes](https://blog.digitalocean.com/digitalocean-releases-k8s-as-a-service/?refcode=f1bcc66950f3). Rancher is a tool that helps you manage multiple Kubernetes clusters in one interface but it does not yet support the new DO offering natively, and I was wondering if one could import a DO managed cluster in your Rancher instance.

Turn out you can, here is how.

## TL;DR: just follow the importer

If you already know how to use the importer for existing clusters then you are good to go. If not, just go there, chose the “Existing Cluster Import” option and follow the steps to import your DO managed cluster 🙂

## Illustrated Guide

Here is a step by step guide on doing the import. It assumes you already have a Rancher instance running somewhere. (Here is [a nice and straightforward guide on running Rancher on DO](https://www.digitalocean.com/community/tutorials/how-to-set-up-multi-node-deployments-with-rancher-2-1-kubernetes-and-docker-machine-on-ubuntu-18-04/?refcode=f1bcc66950f3)).

- Your very first step is to go [create a managed cluster on DO](https://m.do.co/c/f1bcc66950f3). For that connect to your account, and in the sidebar select the “Kubernetes” menu. When there, follow the guide to create your cluster.

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/do-01-kubernetes-setup.png)

- Now that your cluster is provisioning you can download its configuration. We are going to use it to connect to it via `kubectl`.

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/do-02-download-config.png)

- Open your rancher interface, and click on the “Add Cluster” button

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/rancher-01-add-cluster.png)

- Select the “Import existing cluster”

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/rancher-02-select-importer.png)

- The importer will give you a `kubectl` command to run against your [Digital Ocean](https://m.do.co/c/f1bcc66950f3) cluster. Use the previously downloaded config file to run it:

```
$ kubectl --kubeconfig=config-from-do.yml apply -f \ https://your.rancher.domain/v3/import/lotofgibberishrlasxtowg.yaml
```

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/rancher-03-command-to-run.png)

- When the configuration has been applied, your cluster should be imported and available in your rancher interface

![](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/rancher-04-cluster-imported.png)

And voilà, you have imported a [Digital Ocean](https://m.do.co/c/f1bcc66950f3) managed cluster in your Rancher 🎉

*This post was originally published on [mayeu.me](https://mayeu.me/post/how-to-import-digital-ocean-managed-k8s-in-rancher/).*