Skip to content

Connect the target cluster to Zora

After preparing your target clusters, you need to connect them directly to Zora by following the instructions below.

Prerequisites

  1. A kubeconfig file with an authentication token of the target cluster. Follow these instructions to generate it.
  2. The api-server of the target cluster must be reachable by the management cluster.

Without the prerequisites Zora will not be able to connect to the target cluster and will set a failure status.

Metrics Server

If the target cluster hasn't Metrics Server deployed, information about the usage of memory and CPU won't be collected and issues about potential resources over/under allocations won't be reported.

For more information about Metrics Server, visit the official documentation.

1. Access the management cluster

First, make sure you are in the context of the management cluster. You can do this by the following commands:

  • Display list of contexts: kubectl config get-contexts

  • Display the current-context: kubectl config current-context

  • Set the default context to my-management-cluster: kubectl config use-context my-management-cluster

2. Create a Cluster resource

First, create a Secret with the content of the kubeconfig file:

kubectl create secret generic mycluster-kubeconfig \
  -n zora-system \
  --from-file=value=zora-view-kubeconfig.yml

Now, you are able to create a Cluster resource referencing the kubeconfig Secret in the same namespace:

cat << EOF | kubectl apply -f -
apiVersion: zora.undistro.io/v1alpha1
kind: Cluster
metadata:
  name: mycluster
  namespace: zora-system
  labels:
    zora.undistro.io/environment: prod
spec:
  kubeconfigRef:
    name: mycluster-kubeconfig
EOF

If you've made it this far, congratulations, your clusters are connected. Now you can list them and see the discovered data through kubectl:

List clusters

kubectl get clusters -o wide
NAME        VERSION               MEM AVAILABLE   MEM USAGE (%)   CPU AVAILABLE   CPU USAGE (%)   NODES   READY   AGE   PROVIDER   REGION   
mycluster   v1.21.5-eks-bc4871b   10033Mi         3226Mi (32%)    5790m           647m (11%)      3       True    40d   aws        us-east-1

Tip

  • Get clusters from all namespaces using --all-namespaces flag
  • Get clusters with additional information using -o=wide flag
  • Get the documentation for clusters manifests using kubectl explain clusters
  • Get cluster from prod environment using kubectl get clusters -l zora.undistro.io/environment=prod

The cluster list output has the following columns:

  • NAME: Cluster name
  • VERSION: Kubernetes version
  • MEM AVAILABLE: Quantity of memory available (requires Metrics Server)
  • MEM USAGE (%): Usage of memory in quantity and percentage (requires Metrics Server)
  • CPU AVAILABLE: Quantity of CPU available (requires Metrics Server)
  • CPU USAGE (%): Usage of CPU in quantity and percentage (requires Metrics Server)
  • NODES: Total of nodes
  • READY: Indicates whether the cluster is connected
  • AGE: Age of the kube-system namespace in cluster
  • PROVIDER: Cluster provider (with -o=wide flag)
  • REGION: Cluster region (multi-region if nodes have different topology.kubernetes.io/region label) (with -o=wide flag)

Provider

The value in PROVIDER column is obtained by matching the Node's labels (e.g., a Node with label key prefix eks.amazonaws.com/ means that the provider of this cluster is aws).

For now, Zora recognizes only the providers in this list. But you can connect clusters of any provider. If the provider isn't in this list, the column will not be filled and Zora will continue to work normally.

Fell free to contribute to the project and add new labels prefixes for providers. See our contribution guidelines.

Info

  • The quantity of available and in use resources, is a sum of all Nodes.
  • Only one provider is displayed in PROVIDER column. Different information can be displayed for multi-cloud clusters.
  • Show detailed description of a cluster, including events, running kubectl describe cluster mycluster.

Delete a Cluster

To delete a Cluster, use the following command:

kubectl delete cluster mycluster -n zora-system

This command deletes the mycluster Cluster and its scans and issues.

Deleting a Cluster from dashboard (SaaS)

If you installed Zora providing a workspace ID (Zora + SaaS) and want to delete your management cluster, please first delete all target clusters.

If you delete the management cluster first, you will no longer be able to access or delete your target clusters, which will remain on your dashboard until you contact the Undistro team by email: [email protected], so that we can proceed with the deletion.