-
Notifications
You must be signed in to change notification settings - Fork 55
fix (platform): add registration of host clusters #1340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
6421c4a
add registration of host clusters
guowenatk 4204f0e
add initial draft
guowenatk e8ebf68
update document
guowenatk 2f88567
update the content
guowenatk 813fce1
remove unused content
guowenatk 821f952
fix borken link
guowenatk 2b44c14
upgrade format and content
guowenatk 19963e5
add link to agent
guowenatk c8d4552
update content
guowenatk 761f37c
fix vale error
guowenatk 2b3870c
update content
guowenatk 651901f
add the --values flag
guowenatk fc9117b
Merge branch 'main' into doc-429/install-agent
guowenatk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,13 +1,42 @@ | ||
| import Flow, { Step } from '@site/src/components/Flow' | ||
| import NavStep from '@site/src/components/NavStep' | ||
| import Button from '@site/src/components/Button' | ||
| import Label from '@site/src/components/Label' | ||
| import Input from '@site/src/components/Input' | ||
| import Expander from '@site/src/components/Expander' | ||
|
|
||
| When connecting a cluster from the vCluster CLI, you will need to provide a name for the cluster. This name will be used for the Cluster resource that gets created in Kubernetes. Optionally, you can use the `display-name` flag to specify a name for this cluster, when it gets displayed under the <NavStep>Clusters</NavStep> view in vCluster Platform. | ||
| <Flow id="cluster-connect-cli"> | ||
| <Step> | ||
| When connecting a cluster from the vCluster CLI, you will need to provide a name for the cluster. This name will be used for the Cluster resource that gets created in Kubernetes. Optionally, you can use the `display-name` flag to specify a name for this cluster, when it gets displayed under the <NavStep>Clusters</NavStep> view in vCluster Platform. | ||
|
|
||
| ```bash | ||
| vcluster platform add cluster cluster-name --display-name [display-name] | ||
| ``` | ||
| ```bash | ||
| vcluster platform add cluster cluster-name --display-name [display-name] | ||
| ``` | ||
|
|
||
| The above command will automatically install the vCluster Platform Agent in the cluster that is one's current context. If you want to connect a cluster that is not your current context, you can use the `--context` flag to specify the context of the cluster you want to connect. | ||
| The above command automatically installs the [vCluster Platform Agent](/docs/platform/administer/clusters/advanced/agent-config) in the cluster that corresponds to your current Kubernetes context. The host cluster where the vCluster Platform itself is deployed is automatically connected to the platform during installation. Therefore, this command should be executed in a different host cluster from the one where the vCluster Platform is running. | ||
|
|
||
| ```bash | ||
| vcluster platform add cluster cluster-name --display-name [display-name] --context [context] | ||
| ``` | ||
| By default, the `vcluster-platform` namespace is created automatically if it does not already exist on the cluster. The vCluster Platform Agent resources are deployed into this namespace. You can override this behavior by explicitly specifying a different namespace using the `--namespace` flag. If you want to connect a cluster that is not associated with your current Kubernetes context, use the `--context` flag to specify the context of the target cluster. | ||
| :::info | ||
| For more information about available CLI flags, refer to the [CLI documentation](/docs/vcluster/cli/vcluster_platform_add_cluster). | ||
| ::: | ||
|
|
||
| ```bash | ||
| vcluster platform add cluster cluster-name --display-name [display-name] --context [context] | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| You can verify that the cluster is connected to the platform by running: | ||
| ```bash | ||
| vcluster platform list clusters | ||
| ``` | ||
|
|
||
| and the expected output is: | ||
| ```bash | ||
| CLUSTER | AGE | ||
| --------------------+-------- | ||
| cluster-name | 7s | ||
| host-cluster | 10m4s | ||
| ``` | ||
| The `host-cluster` is the cluster name where the vCluster Platform is deployed. | ||
| </Step> | ||
| </Flow> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,82 +1,101 @@ | ||
| import Flow, { Step } from '@site/src/components/Flow' | ||
| import NavStep from '@site/src/components/NavStep' | ||
|
|
||
|
|
||
| If you prefer to use Helm, you need to make sure that you have a valid Access Key. | ||
|
|
||
| You can either reuse the CLI Access Key or create a new one by following the | ||
| [Access Key guide](../../administer/users-permissions/access-keys.mdx#create-an-access-key). | ||
|
|
||
|
|
||
| - Reusing the CLI Access Key | ||
|
|
||
| ```bash | ||
| export ACCESS_KEY=$(vcluster platform access-key | jq -r .status.token) | ||
| ``` | ||
|
|
||
| - Create new Access Key by following the [Access | ||
| Key](/platform/administer/users-permissions/access-keys#create-an-access-key) guide. | ||
|
|
||
| ```bash | ||
| export ACCESS_KEY="[Newly Created Access Key]" | ||
| ``` | ||
|
|
||
| After that, you need to provide a name for the cluster. | ||
|
|
||
| ```bash | ||
| export CLUSTER_NAME="cluster-name" | ||
| ``` | ||
|
|
||
| Next, you must create the Cluster custom resource within the platform using the following code: | ||
|
|
||
| ```bash | ||
| cat <<EOF | kubectl apply -f - | ||
| apiVersion: management.loft.sh/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: $CLUSTER_NAME | ||
| spec: | ||
| displayName: $CLUSTER_NAME | ||
| networkPeer: true | ||
| managementNamespace: vcluster-platform | ||
| EOF | ||
| ``` | ||
|
|
||
| Then, you need to set the Platform Host using the following code: | ||
|
|
||
| ```bash | ||
| export PLATFORM_HOST="YOUR_LOFT_HOST" | ||
| ``` | ||
|
|
||
| To get the Platform version, you should run the following command: | ||
|
|
||
| ```bash | ||
| export PLATFORM_VERSION=$(curl -s "https://$PLATFORM_HOST/version" | jq -r '.version | .[0:]') | ||
| ``` | ||
|
|
||
| To get the Cluster Connect token, you should run the following command: | ||
|
|
||
| ```bash | ||
| export CLUSTER_ACCESS_KEY=$(curl -s "https://$PLATFORM_HOST/kubernetes/management/apis/management.loft.sh/v1/clusters/$CLUSTER_NAME/accesskey" -H "Authorization: bearer $ACCESS_KEY") | ||
| ``` | ||
|
|
||
| Finally, you can connect the cluster using the following command: | ||
|
|
||
| ```bash | ||
| helm upgrade loft vcluster-platform --install \ | ||
| --repo https://charts.loft.sh/ \ | ||
| --version $PLATFORM_VERSION \ | ||
| --namespace vcluster-platform \ | ||
| --create-namespace \ | ||
| --set agentOnly=true \ | ||
| --set url=https://$PLATFORM_HOST \ | ||
| --set token=$(echo $CLUSTER_ACCESS_KEY | jq -r .accessKey) \ | ||
| --set additionalCA=$(echo $CLUSTER_ACCESS_KEY | jq -r .caCert) \ | ||
| --set insecure=$(echo $CLUSTER_ACCESS_KEY | jq -r .insecure) | ||
| ``` | ||
| :::warning | ||
| vCluster Platform exclusively supports the default `secret` backend for storing Helm releases. Alternative `HELM_DRIVER` configurations (such as `configmap` or `sql`) are not supported. | ||
| ::: | ||
|
|
||
| This command automatically installs the Platform Agent in the cluster that is your current context. | ||
| However, if you want to connect a cluster that is not your current context, you can append the `--kube-context` flag to specify the context of the cluster you want to connect. | ||
|
|
||
| import Button from '@site/src/components/Button' | ||
| import Label from '@site/src/components/Label' | ||
| import Input from '@site/src/components/Input' | ||
| import Expander from '@site/src/components/Expander' | ||
|
|
||
| <Flow id="cluster-connect-helm"> | ||
| <Step> | ||
| If you prefer to use Helm, you need to make sure that you have a valid Access Key. | ||
|
|
||
| You can either reuse the CLI Access Key or create a new one by following the | ||
| [Access Key guide](../../administer/users-permissions/access-keys.mdx#create-an-access-key). | ||
|
|
||
|
|
||
| - Reusing the CLI Access Key | ||
|
|
||
| ```bash | ||
| export ACCESS_KEY=$(vcluster platform access-key | jq -r .status.token) | ||
| ``` | ||
|
|
||
| - Create new Access Key by following the [Access | ||
| Key](/platform/administer/users-permissions/access-keys#create-an-access-key) guide. | ||
|
|
||
| ```bash | ||
| export ACCESS_KEY="[Newly Created Access Key]" | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| After that, you need to provide a name for the cluster. | ||
|
|
||
| ```bash | ||
| export CLUSTER_NAME="cluster-name" | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| Next, you must create the `Cluster` custom resource within the platform using the following code: | ||
|
|
||
| ```bash | ||
| cat <<EOF | kubectl apply -f - | ||
| apiVersion: management.loft.sh/v1 | ||
| kind: Cluster | ||
| metadata: | ||
| name: $CLUSTER_NAME | ||
| spec: | ||
| displayName: $CLUSTER_NAME | ||
| networkPeer: true | ||
| managementNamespace: vcluster-platform | ||
| EOF | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| Then, you need to set the Platform Host using the following code: | ||
|
|
||
| ```bash | ||
| export PLATFORM_HOST="YOUR_PLATFORM_HOST" | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| To get the Platform version, you should run the following command: | ||
|
|
||
| ```bash | ||
| export PLATFORM_VERSION=$(curl -s "https://$PLATFORM_HOST/version" | jq -r '.version | .[0:]') | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| To get the Cluster Connect token, you should run the following command: | ||
|
|
||
| ```bash | ||
| export CLUSTER_ACCESS_KEY=$(curl -s "https://$PLATFORM_HOST/kubernetes/management/apis/management.loft.sh/v1/clusters/$CLUSTER_NAME/accesskey" -H "Authorization: bearer $ACCESS_KEY") | ||
| ``` | ||
| </Step> | ||
| <Step> | ||
| Finally, you can connect the cluster using the following command: | ||
|
|
||
| ```bash | ||
| helm upgrade loft vcluster-platform --install \ | ||
| --repo https://charts.loft.sh/ \ | ||
| --version $PLATFORM_VERSION \ | ||
| --namespace vcluster-platform \ | ||
| --create-namespace \ | ||
| --set agentOnly=true \ | ||
| --set url=https://$PLATFORM_HOST \ | ||
| --set token=$(echo $CLUSTER_ACCESS_KEY | jq -r .accessKey) \ | ||
| --set additionalCA=$(echo $CLUSTER_ACCESS_KEY | jq -r .caCert) \ | ||
| --set insecure=$(echo $CLUSTER_ACCESS_KEY | jq -r .insecure) | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| This command automatically installs the [vCluster Platform Agent](/docs/platform/administer/clusters/advanced/agent-config) in the cluster that is your current context. | ||
| However, if you want to connect a cluster that is not your current context, you can append the `--kube-context` flag to specify the context of the cluster you want to connect. | ||
|
|
||
| You can also retrieve pre-configured agent values from your platform by appending the `--values` flag with the platform endpoint `--values "https://$HOST/clusters/agent-values/$CLUSTER_NAME?token=$TOKEN"`. | ||
| - `$HOST` — your vCluster Platform domain | ||
| - `$CLUSTER_NAME` — the name you're assigning to the cluster being connected (e.g., `cluster-name`) | ||
| - `$TOKEN` — the authentication token to access your vCluster Platform | ||
| The endpoint returns an intelligently merged content of | ||
| - Platform-level defaults configured in the `agentValues` field of your vCluster Platform Helm values | ||
| - Cluster-specific overrides from the `loft.sh/agent-values` annotation (when present) | ||
|
|
||
| </Step> | ||
| </Flow> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import Flow, { Step } from '@site/src/components/Flow' | ||
| import NavStep from '@site/src/components/NavStep' | ||
| import Button from '@site/src/components/Button' | ||
| import Label from '@site/src/components/Label' | ||
| import Input from '@site/src/components/Input' | ||
| import Expander from '@site/src/components/Expander' | ||
|
|
||
|
|
||
| <Flow id="upgrade-cluster-cli"> | ||
| <Step> | ||
| You can verify that the [vCluster Platform Agent](/docs/platform/administer/clusters/advanced/agent-config) is installed in the cluster by running: | ||
|
|
||
| ```bash | ||
| vcluster platform list clusters | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| The expected output would be: | ||
|
|
||
| ```bash | ||
| CLUSTER | AGE | ||
| --------------------+-------- | ||
| cluster-name | 7s | ||
| ``` | ||
|
|
||
| In this example, the host cluster where the platform agent is installed is named `cluster-name`. | ||
| </Step> | ||
| <Step> | ||
| By providing the Helm chart version and values configuration, you can install or upgrade the existing platform agent deployment for the `cluster-name` cluster using: | ||
|
|
||
| ``` | ||
| vcluster platform add cluster cluster-name \ | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --helm-chart-version v4.5 \ | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --helm-values my-helm-values \ | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --context cluster-name-context | ||
| ``` | ||
|
|
||
| Choose the appropriate version in `--helm-chart-version` and Helm chart configuration in `--helm-values`. Replace `--context` with the Kubernetes context of your target cluster. | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| If you are already operating within that cluster’s context, you can omit the --context flag — the command will automatically install or upgrade the platform agent in the current cluster. | ||
| You can find more details about the available flags for the `vcluster platform add cluster` command in the [CLI documentation](/docs/vcluster/cli/vcluster_platform_add_cluster). | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </Step> | ||
| </Flow> | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import Flow, { Step } from '@site/src/components/Flow' | ||
| import NavStep from '@site/src/components/NavStep' | ||
| import Button from '@site/src/components/Button' | ||
| import Label from '@site/src/components/Label' | ||
| import Input from '@site/src/components/Input' | ||
| import Expander from '@site/src/components/Expander' | ||
|
|
||
| <Flow id="upgrade-cluster-helm"> | ||
| <Step> | ||
| If you prefer to use Helm, ensure that you have a valid access key. You can only obtain an access key after the cluster has been connected to the Platform. | ||
| </Step> | ||
| <Step> | ||
| To retrieve the access key for a connected cluster, run: | ||
|
|
||
| ```bash | ||
| vcluster platform get cluster-access-key cluster-name | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
|
|
||
| The expected output is: | ||
|
|
||
| ```bash | ||
| 14:43:35 info vCluster platform host: https://loftg2fei.loft.host | ||
| 14:43:35 info Access Key: xxxxxxxx | ||
| ``` | ||
| In this example, `cluster-name` refers to the host cluster containing the [vCluster Platform Agent](/docs/platform/administer/clusters/advanced/agent-config) to be upgraded. | ||
|
|
||
| <!-- vale off --> | ||
| Here, `https://loftg2fei.loft.host` represents the `url`, and `xxxxxxxx` is the `token`. | ||
| <!-- vale on --> | ||
| </Step> | ||
| <Step> | ||
| Next, use the following Helm command to upgrade the platform agent by providing the retrieved `url` and `token`: | ||
|
|
||
| ```yaml | ||
| helm upgrade loft vcluster-platform \ | ||
| --repo https://charts.loft.sh \ | ||
| --install \ | ||
| --create-namespace \ | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| --namespace vcluster-platform \ | ||
| --set agentOnly=true \ | ||
| --set url=https://loftg2fei.loft.host \ | ||
| --set token=xxxxxxxx | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ``` | ||
| Ensure that the namespace specified with `--namespace` exists. This is the namespace where the platform agent is installed. | ||
| If you deploy the platform agent’s resources into a different namespace, make sure to set `--namespace` accordingly. | ||
|
|
||
| You can also retrieve pre-configured agent values from your platform by appending the `--values` flag with platform endpoint | ||
| `--values "https://$HOST/clusters/agent-values/$CLUSTER_NAME?token=$TOKEN"`. | ||
| - `$HOST` — your platform domain. | ||
| - `$CLUSTER_NAME` — the name of the cluster you are connecting. | ||
| - `$TOKEN` — the authentication token. | ||
| In this example, `$HOST=loftg2fei.loft.host`, `$CLUSTER_NAME=cluster-name` and `$TOKEN=xxxxxxxx`. | ||
| The endpoint returns a YAML file with agent values that are configured in the `agentValues` field of your vCluster | ||
| Platform Helm values, merged with any cluster-specific overrides from the `loft.sh/agent-values` annotation (when present). | ||
|
|
||
| If the platform agent is not yet installed, you can include the `--install` and `--create-namespace` flags. The combination | ||
| of `--create-namespace` and `--namespace vcluster-platform` will create the `vcluster-platform` namespace in the host cluster | ||
| if it does not already exist. All platform agent resources will then be deployed and run within that namespace. | ||
| </Step> | ||
| </Flow> | ||
guowenatk marked this conversation as resolved.
Show resolved
Hide resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.