|
| 1 | +# Tutorial: Installing Agent on Clusters |
| 2 | +This tutorial will guide you through the process of installing fleet agent on hub & member clusters. |
| 3 | + |
| 4 | +Follow these guides to ...: |
| 5 | + |
| 6 | +- [Quickstart: Create an Azure Kubernetes Fleet Manager resource and join member clusters using Azure CLI (With Hub Cluster)](https://learn.microsoft.com/en-us/azure/kubernetes-fleet/quickstart-create-fleet-and-members?tabs=with-hub-cluster) |
| 7 | +- [Quickstart: Access the Kubernetes API of the Fleet hub cluster](https://learn.microsoft.com/en-us/azure/kubernetes-fleet/quickstart-access-fleet-kubernetes-api) |
| 8 | + |
| 9 | +## Prerequisites |
| 10 | + |
| 11 | +- [Docker](https://docs.docker.com/get-docker/) |
| 12 | +- [Helm](https://github.com/helm/helm#install) |
| 13 | +- [kubectl](https://kubernetes.io/docs/tasks/tools/install-kubectl/) |
| 14 | + |
| 15 | +## Steps to installing fleet agent on clusters |
| 16 | + |
| 17 | +> **Note:** Please read through the entire document before running the scripts. |
| 18 | +
|
| 19 | +### Run the join script in the fleet repository |
| 20 | + |
| 21 | +Clone the [fleet repository](https://github.com/Azure/fleet) and navigate to the root directory of the repo. |
| 22 | + |
| 23 | +Run the following script which sets up the resources on the hub cluster and each on-prem cluster to allow |
| 24 | +the member agent installed by the script on each on-prem cluster to communicate with the hub cluster. |
| 25 | + |
| 26 | +> **Note:** The script creates resources on the hub cluster in a namespace called `connect-to-fleet` and also creates |
| 27 | +> a secret on each on-prem cluster please don't update/delete these resources. |
| 28 | +
|
| 29 | +The latest fleet image tag could be found here in [fleet releases](https://github.com/Azure/fleet/releases). |
| 30 | + |
| 31 | +> **Note:** Please ensure kubectl can access the kube-config of the hub cluster and all the on-prem clusters. |
| 32 | +
|
| 33 | +Ex: |
| 34 | +- `./hack/membership/joinMC.sh v0.1.0 hub test-cluster-1` |
| 35 | +- `./hack/membership/joinMC.sh v0.1.0 hub test-cluster-1 test-cluster-2` |
| 36 | + |
| 37 | +```shell |
| 38 | +chmod +x ./hack/membership/joinMC.sh |
| 39 | +./hack/membership/joinMC.sh <FLEET-IMAGE-TAG> <HUB-CLUSTER-NAME> <MEMBER-CLUSTER-NAME-1> <MEMBER-CLUSTER-NAME-2> <MEMBER-CLUSTER-NAME-3> ... |
| 40 | +``` |
| 41 | + |
| 42 | +The output should look like: |
| 43 | + |
| 44 | +``` |
| 45 | +% kubectl get membercluster -A |
| 46 | +NAME JOINED AGE MEMBER-AGENT-LAST-SEEN NODE-COUNT AVAILABLE-CPU AVAILABLE-MEMORY |
| 47 | +test-cluster-1 Unknown 3m33s 5s 1 890m 4074756Ki |
| 48 | +test-cluster-2 Unknown 3m16s 4s 1 890m 4074756Ki |
| 49 | +``` |
| 50 | + |
| 51 | +> **Note:** The `JOINED` column will be `Unknown` until the fleet networking member agent charts are installed on each on-prem cluster. |
| 52 | +
|
| 53 | +We can confirm that the member agent was installed correctly when we see `MEMBER-AGENT-LAST-SEEN`, `NODE-COUNT`, `AVAILABLE-CPU`, and `AVAILABLE-MEMORY` columns populated. |
| 54 | +The columns mentioned can take upto a minute to populate. |
| 55 | + |
| 56 | +> **Note:** The script in the fleet-networking repo should only be run once the script in the fleet repo has been |
| 57 | +> run to ensure the member agents can communicate with the hub cluster. |
| 58 | +
|
| 59 | +### Run the join script in the fleet networking repository |
| 60 | + |
| 61 | +Clone the [fleet-networking repository](https://github.com/Azure/fleet-networking) and navigate to the root directory of the repo. |
| 62 | + |
| 63 | +Run the following script to install the fleet networking member agents on each on-prem cluster. |
| 64 | + |
| 65 | +The latest fleet-networking image tag could be found here [fleet-networking releases](https://github.com/Azure/fleet-networking/releases). |
| 66 | + |
| 67 | +Ex: |
| 68 | +- `./hack/membership/joinMC.sh v0.1.0 v0.2.0 hub test-cluster-1` |
| 69 | +- `./hack/membership/joinMC.sh v0.1.0 v0.2.0 hub test-cluster-1 test-cluster-2` |
| 70 | + |
| 71 | +```shell |
| 72 | +chmod +x ./hack/membership/joinMC.sh |
| 73 | +./hack/membership/joinMC.sh <FLEET-IMAGE-TAG> <FLEET-NETWORKING-IMAGE-TAG> <HUB-CLUSTER-NAME> <MEMBER-CLUSTER-NAME-1> <MEMBER-CLUSTER-NAME-2> <MEMBER-CLUSTER-NAME-3> ... |
| 74 | +``` |
| 75 | + |
| 76 | +The output should look like: |
| 77 | + |
| 78 | +``` |
| 79 | +% kubectl get membercluster -A |
| 80 | +NAME JOINED AGE MEMBER-AGENT-LAST-SEEN NODE-COUNT AVAILABLE-CPU AVAILABLE-MEMORY |
| 81 | +test-cluster-1 True 6m49s 6s 1 490m 3550468Ki |
| 82 | +test-cluster-2 True 6m32s 4s 1 490m 3550468Ki |
| 83 | +``` |
| 84 | + |
| 85 | +The `JOINED` column will be `True` once both fleet networking member agent charts are installed on each on-prem cluster and the networking |
| 86 | +member agents are able to communicate with fleet hub cluster. |
| 87 | +The column can take upto a minute to populate. The `JOINED` column indicates that all three fleet member agents have all joined once. |
| 88 | +The column is not meant for tracking each member agent's health status. |
0 commit comments