Cloud Native / Kubernetes / Contributed

Tutorial: Use KubeSphere to Manage DigitalOcean Kubernetes and Amazon EKS

23 Nov 2020 12:16pm, by

Feynman Zhou
Feynman is a CNCF ambassador and open source community manager at QingCloud, he is growing and maintaining the KubeSphere community, which helps users to widely adopt Kubernetes and reduce the learning curve of using cloud native technologies.

KubeSphere is an open source distributed operating system for managing cloud native applications. Using Kubernetes as its kernel, KubeSphere provides a plug-and-play architecture for the seamless integration of third-party applications to boost its ecosystem. KubeSphere can be run anywhere as it is highly pluggable and doesn’t require hacking into Kubernetes.

KubeSphere is developed to address multicluster and multicloud management challenges and implement the proceeding user scenarios, providing users with a unified control plane to distribute applications and its replicas to multiple clusters from the public cloud to on-premises environments.

Kubernetes Cluster Federation in KubeSphere

Based on Kubernetes Cluster Federation (Kubefed for short), KubeSphere implements multicluster management which allows cluster administrators to easily manage multiple Kubernetes clusters across cloud providers.

In this tutorial, we install a host cluster in the data center to play the role of the control plane for member clusters. Then we use two popular hosted Kubernetes services, DigitalOcean Kubernetes and Amazon EKS, and import them into the host cluster.

Prepare a Host Cluster

Before you begin, you need to install a KubeSphere cluster, see the quickstarts All-in-one or minimal KubeSphere on Kubernetes for details. In this tutorial, we choose to install KubeSphere in data center.

After a KubeSphere cluster is ready, then you can set the value of clusterRole to host by editing the cluster configuration using kubectl:

Scroll down and set the value of clusterRole to host, then click Update (if you use the web console) to make it effective:

Save it, you need to wait for a while so that the change can take effect. After the installation of the host cluster, a proxy service called tower will be created in kubesphere-system, whose type is LoadBalancer.

If a LoadBalancer plugin is available for the cluster, you can see a corresponding address for EXTERNAL-IP, which will be acquired by KubeSphere automatically. That means you can skip the step to set the proxy. Execute the following command to check the service.

The output may look as follows:

Prepare Two Member Clusters

Before you begin, you need to install a minimal KubeSphere on Amazon EKS and DigitalOcean Kubernetes, see Deploy KubeSphere on Amazon EKS and Deploy KubeSphere on DigitalOcean Kubernetes for details.

In order to manage the member cluster within the host cluster, you need to make jwtSecret the same between them. Therefore, you need to get it first from the host cluster by the following command.

The output may look like this:

If you have already installed KubeSphere on Amazon EKS and DigitalOcean Kubernetes, you can set the value of clusterRole to member by editing the cluster configuration. Please note that this step should be executed in two-member clusters respectively:

Input the corresponding jwtSecret shown above:

Scroll down and set the value of clusterRole to member, then click Update (if you use the web console) to make it effective:

Import Member Clusters into Control Plane

Make sure you have installed two-member clusters for Amazon EKS and DigitalOcean Kubernetes. Then you are ready to start these two member clusters into the host cluster. We just take an example of importing Amazon EKS into host cluster in this tutorial, the steps of importing DigitalOcean Kubernetes are the same with the follows.

Open the Host cluster dashboard and click Add Cluster.

Enter the basic information of the cluster to be imported and click Next.

In the Connection Method, select Cluster connection agent and click Import. It will show the agent deployment generated by the Host cluster in the console.

Create an agent.yaml file in the member cluster based on the instruction, then copy and paste the agent deployment to the file. Execute kubectl create -f agent.yaml on the node and wait for the agent to be up and running. Please make sure the proxy address is accessible to the member cluster.

You can see the cluster you have imported in the host cluster when the cluster agent is up and running.

Enter into the Amazon EKS cluster from member cluster list, you will be able to see the overview dashboard for the cluster, including cluster monitoring metrics and logging.

Congratulation! Now the Amazon EKS has been imported and managed by KubeSphere, you should now be able to import the DigitalOcean Kubernetes into it. After two-member clusters are ready, it will be pretty easier to distribute cloud native applications across a multicloud environment, enjoy it!

A newsletter digest of the week’s most important stories & analyses.