Import an External Kubernetes Cluster

Import an external or On-Prem cluster to be managed by DuploCloud

DuploCloud allows an external or an On-Premises Kubernetes (K8s) Cluster to be imported as an Infrastructure that the DuploCloud Platform manages.

Prerequisite

The Kubernetes Cluster that needs to be imported should be ready to use and accessible using the kubectlshell.

Creating a service account in the K8s cluster with admin permissions

  1. Save this YAML code as a file name service-account-admin-setup.yaml.

service-account-admin-setup.yaml
example with admin access
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: duplo-admin-user
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: duplo-admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: duplo-admin-user
  namespace: kube-system
---
apiVersion: v1
kind: Secret
metadata:
  name: duplo-admin-token
  namespace: kube-system
  annotations:
    kubernetes.io/service-account.name: duplo-admin-user
type: kubernetes.io/service-account-token
---
  1. Run kubectl apply -f service-account-admin-setup.yaml, creating a new service account with Administrator permissions.

  2. Run kubectl -n kube-system describe secret duplo-admin-token to fetch the token for DuploCloud to use when importing the cluster.

Importing your Kubernetes Cluster to DuploCloud

Before performing this step, Contact DuploCloud Support to enable the configuration that allows the import of an external Kubernetes cluster.

  1. In the DuploCloud Portal, navigate to Administrator -> Infrastructure.

  2. Click Add. The Add Infrastructure page displays.

  3. From the Cloud list box, select On-Premises.

  4. Enter the details of the Kubernetes Cluster:

    • Kubernetes Cluster Name

    • Kubernetes Cluster Endpoint

    • Kubernetes Token, which you retrieved when you created a service account in the previous step.

    • Kubernetes Cluster Certificate Authority Data (For an EKS cluster, this can be copied from the EKS Cluster Overview page from the AWS Console).

    • Kubernetes Vendor (Enter EKS, as in the example below).

Viewing Imported Kubernetes Cluster from DuploCloud

Select the Kubernetes tab to display information about the imported Kubernetes Cluster.

Adding Existing Nodes for the imported cluster in DuploCloud

  1. In the DuploCloud Portal, navigate to Administrator -> Tenants.

  2. Click Add. The Create a Tenant pane displays.

  3. Enter the Tenant Name.

  4. Select the Infrastructure name from the Plan list box.

  5. Click Create.

  6. Navigate to Kubernetes -> Nodes. The Nodes page displays.

  7. Click the On-Premises Tab.

  8. Click Add. The Add On-Premesis Instance pane displays.

  9. Select the node from the Kubernetes Node list box.

  10. Supply an Allocation Tag.

  11. Click Add.

  12. Navigate to Kubernetes -> Nodes to view the imported cluster.

Creating a WebServer Service with Cloud as On-Premises

Create a WebServer Service in the DuploCloud portal by selecting OnPrem from the Cloud list box while creating a Kubernetes Service.

Once the service is created, you should be able to access the kubectl shell, retrieve the KubeCtl Token, Host/Container shell, and Container logs for the service you created.

Importing External Kubernetes Cluster as Read-Only

An administrator can import an external Kubernetes cluster in the DuploCloud Portal with readonly access.

Creating a Service Account in the K8s cluster with Read-Only Access

  1. Save the following YAML code as service-account-readonly-setup.yaml.

service-account-readonly-setup.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: duplo-readonly-user
  namespace: kube-system
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: duplo-readonly-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: view
subjects:
- kind: ServiceAccount
  name: duplo-readonly-user
  namespace: kube-system
---
apiVersion: v1
kind: Secret
metadata:
  name: duplo-readonly-token
  namespace: kube-system
  annotations:
    kubernetes.io/service-account.name: duplo-readonly-user
type: kubernetes.io/service-account-token
---
  1. Run kubectl apply -f service-account-readonly-setup.yaml, creating a new service account with readonly permission.

  2. Run kubectl -n kube-system describe secret duplo-readonly-token to fetch the token for DuploCloud to use when importing the cluster.

Importing the Kubernetes cluster to DuploCloud

Follow this step to import and view the cluster.

DuploCloud users with non-administrator access (User role) can only view Kubernetes resources. They cannot add Nodes or create or update any Services in readonly mode.

Last updated

Logo

© DuploCloud, Inc. All rights reserved. DuploCloud trademarks used herein are registered trademarks of DuploCloud and affiliates