clusternet-hub

by Clusternet

Helm chartv1.0.0App v1.0.0

Chart for clusternet-hub

About this chart

How to install clusternet-hub

clusternet-hub is responsible for

  • approving cluster registration requests and creating dedicated resources, such as namespaces, serviceaccounts and RBAC rules, for each child cluster;
  • serving as an aggregated apiserver (AA), which is used to serve as a websocket server that maintain multiple active websocket connections from child clusters;
  • providing Kubernstes-styled API to redirect/proxy/upgrade requests to each child cluster;
  • coordinating and deploying applications to multiple clusters from a single set of APIs;

:pushpin: :pushpin: Note:

Since clusternet-hub is running as an AA, please make sure that parent apiserver could visit the clusternet-hub service.

Prerequisites

  • Kubernetes 1.18+
  • Helm 3.1.0

TL;DR

helm repo add clusternet https://clusternet.github.io/charts
helm install clusternet-hub -n clusternet-system --create-namespace clusternet/clusternet-hub

Create Auth Token

  • If bootstrapping authentication is supported, i.e. --enable-bootstrap-token-auth=true is explicitly set in the kube-apiserver running in parent cluster.

    kubectl apply -f https://raw.githubusercontent.com/clusternet/clusternet/main/manifests/samples/cluster_bootstrap_token.yaml
    
  • If bootstrapping authentication is not supported by the kube-apiserver in parent cluster (like k3s) , i.e. --enable-bootstrap-token-auth=false (which defaults to be false), please use serviceaccount token instead.

    # this will create a serviceaccount token
    kubectl apply -f https://raw.githubusercontent.com/clusternet/clusternet/main/manifests/samples/cluster_serviceaccount_token.yaml
    

Get ServiceAccount Token from parent cluster

kubectl get secret -n clusternet-system -o=jsonpath='{.items[?(@.metadata.annotations.kubernetes\.io/service-account\.name=="cluster-bootstrap-use")].data.token}' | base64 -i --decode; echo
# HERE WILL OUTPUTS A LONG STRING. PLEASE REMEMBER THIS.

Step-by-step Installation & Uninstallation

Installing the Chart

Note: The images are synced to dockerhub as well, you could set image.registry to empty or docker.io if needed.

To install the chart with the release name clusternet-hub:

helm repo add clusternet https://clusternet.github.io/charts
helm install clusternet-hub -n clusternet-system --create-namespace clusternet/clusternet-hub
kubectl apply -f https://raw.githubusercontent.com/clusternet/clusternet/main/manifests/samples/cluster_bootstrap_token.yaml

These commands deploy clusternet-hub on the Kubernetes cluster in the default configuration. The Parameters section lists the parameters that can be configured during installation.

Tip: List all releases using helm list -A

Uninstalling the Chart

To uninstall/delete the clusternet-hub deployment:

helm delete clusternet-hub -n clusternet-system

The command removes all the Kubernetes components associated with the chart and deletes the release.

Parameters

Common parameters

NameDescriptionValue
kubeVersionOverride Kubernetes version""
nameOverrideString to partially override common.names.fullname""
fullnameOverrideString to fully override common.names.fullname""
commonLabelsLabels to add to all deployed objects{}
commonAnnotationsAnnotations to add to all deployed objects{}

Exposure parameters

NameDescriptionValue
replicaCountSpecify number of clusternet-hub replicas3
serviceAccount.nameThe name of the ServiceAccount to create"clusternet-hub"
securePortPort where clusternet-hub will be running443
peerPortPort where clusternet-hub peer will be advertised8123
image.registryclusternet-hub image registryghcr.io
image.repositoryclusternet-hub image repositoryclusternet/clusternet-hub
image.tagclusternet-hub image tag (immutable tags are recommended)v1.0.0
image.pullPolicyclusternet-hub image pull policyIfNotPresent
image.pullSecretsSpecify docker-registry secret names as an array[]
reservedNamespaceReserved namespace used for creating Manifest by clusternet-hubclusternet-reserved
anonymousAuthSupportedWhether the anonymous access is allowed by the 'core' kubernetes servertrue
leaderElectEnable or disable leader electtrue
featureGatesEnable or disable feature gatesSocketConnection=true,ShadowAPI=true
kubeAPI.burstKubernetes API client Burst limit to use while talking with 'core' kubernetes apiserver100
kubeAPI.qpsKubernetes API client QPS limit to use while talking with the 'core' kubernetes apiserver50.0
extraArgsAdditional command line arguments to pass to clusternet-hub{}
resources.limitsThe resources limits for the container{}
resources.requestsThe requested resources for the container{}
nodeSelectorNode labels for pod assignment{}
priorityClassNameSet Priority Class Name to allow priority control over other pods""
hostNetworkSpecify whether to use the host's networking stackfalse
tolerationsTolerations for pod assignment[]
podAffinityPresetPod affinity preset. Ignored if affinity is set. Allowed values: soft or hard""
podAntiAffinityPresetPod anti-affinity preset. Ignored if affinity is set. Allowed values: soft or hardsoft
nodeAffinityPreset.typeNode affinity preset type. Ignored if affinity is set. Allowed values: soft or hard""
nodeAffinityPreset.keyNode label key to match. Ignored if affinity is set.""
nodeAffinityPreset.valuesNode label values to match. Ignored if affinity is set.[]
affinityAffinity for pod assignment{}

Deploy clusternet-hub with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has clusternet-hub on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartclusternet-hub is pinned at v1.0.0 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply