[doc] some text changes to make desc more clear

Signed-off-by: windsonsea <haifeng.yao@daocloud.io>
This commit is contained in:
windsonsea 2022-06-21 09:29:03 +08:00
parent d607f26b19
commit 2279228e7f
1 changed files with 24 additions and 21 deletions

View File

@ -2,21 +2,21 @@
## Purpose ## Purpose
For a member cluster that joins Karmada in pull mode, we need to provide a method to connect the network between the Karmada control plane and the member cluster, so that karmada-aggregated-apiserver can access this member cluster. For a member cluster that joins Karmada in the pull mode, you need to provide a method to connect the network between the Karmada control plane and the member cluster, so that karmada-aggregated-apiserver can access this member cluster.
Deploying ANP to achieve appeal is one of the methods. This article describes how to deploy ANP in Karmada. Deploying ANP to achieve appeal is one of the methods. This article describes how to deploy ANP in Karmada.
## Environment ## Environment
Karmada deployed using the kind tool. Karmada can be deployed using the kind tool.
We can directly `hack/local-up-karmada.sh` to deploy Karmada. You can directly use `hack/local-up-karmada.sh` to deploy Karmada.
## Actions ## Actions
### Step 1: Download code ### Step 1: Download code
To facilitate demonstration, the code is modified based on ANP v0.0.24 to support access to the front server through HTTP. Here is the code base address: https://github.com/mrlihanbo/apiserver-network-proxy/tree/v0.0.24/dev. To facilitate demonstration, the code is modified based on ANP v0.0.24 to support access to the front server through HTTP. Here is the code repository address: https://github.com/mrlihanbo/apiserver-network-proxy/tree/v0.0.24/dev.
```shell ```shell
git clone -b v0.0.24/dev https://github.com/mrlihanbo/apiserver-network-proxy.git git clone -b v0.0.24/dev https://github.com/mrlihanbo/apiserver-network-proxy.git
@ -33,7 +33,7 @@ docker build . --build-arg ARCH=amd64 -f artifacts/images/agent-build.Dockerfile
docker build . --build-arg ARCH=amd64 -f artifacts/images/server-build.Dockerfile -t swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-server:0.0.24 docker build . --build-arg ARCH=amd64 -f artifacts/images/server-build.Dockerfile -t swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-server:0.0.24
``` ```
### Step 3: Generate certificate ### Step 3: Generate a certificate
Run the command to check the IP address of karmada-host-control-plane: Run the command to check the IP address of karmada-host-control-plane:
@ -41,17 +41,17 @@ Run the command to check the IP address of karmada-host-control-plane:
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' karmada-host-control-plane docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' karmada-host-control-plane
``` ```
Run the make certs command to generate a certificate and specify PROXY_SERVER_IP as the IP address obtained in the preceding command. Run the `make certs` command to generate a certificate and specify PROXY_SERVER_IP as the IP address obtained in the preceding command.
```shell ```shell
make certs PROXY_SERVER_IP=x.x.x.x make certs PROXY_SERVER_IP=x.x.x.x
``` ```
The generated certificate is in the `certs` folder. The certificate is generated in the `certs` folder.
### Step 4: Deploy proxy-server ### Step 4: Deploy proxy-server
Save the `proxy-server.yaml` file in the root directory of the ANP code. Save the `proxy-server.yaml` file in the root directory of the ANP code repository.
<details> <details>
<summary>unfold me to see the yaml</summary> <summary>unfold me to see the yaml</summary>
@ -133,7 +133,7 @@ data:
</details> </details>
Save the `replace-proxy-server.sh` file in the root directory of the ANP code. Save the `replace-proxy-server.sh` file in the root directory of the ANP code repository.
<details> <details>
<summary>unfold me to see the shell</summary> <summary>unfold me to see the shell</summary>
@ -165,14 +165,14 @@ sed -i'' -e "s/{{cluster_key}}/${CLUSTER_KEY}/g" ${cert_yaml}
</details> </details>
Run the following command to run the script: Run the following commands to run the script:
```shell ```shell
chmod +x replace-proxy-server.sh chmod +x replace-proxy-server.sh
bash replace-proxy-server.sh bash replace-proxy-server.sh
``` ```
Deploying the proxy-server on the Karmada control plane: Deploy the proxy-server on the Karmada control plane:
```shell ```shell
kind load docker-image swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-server:0.0.24 --name karmada-host kind load docker-image swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-server:0.0.24 --name karmada-host
@ -182,7 +182,7 @@ kubectl --context=karmada-host apply -f proxy-server.yaml
### Step 5: Deploy proxy-agent ### Step 5: Deploy proxy-agent
Save the `proxy-agent.yaml` file in the root directory of the ANP code. Save the `proxy-agent.yaml` file in the root directory of the ANP code repository.
<details> <details>
<summary>unfold me to see the yaml</summary> <summary>unfold me to see the yaml</summary>
@ -252,7 +252,7 @@ data:
</details> </details>
Save the `replace-proxy-agent.sh` file in the root directory of the ANP code. Save the `replace-proxy-agent.sh` file in the root directory of the ANP code repository.
<details> <details>
<summary>unfold me to see the shell</summary> <summary>unfold me to see the shell</summary>
@ -279,29 +279,32 @@ sed -i'' -e "s/{{proxy_agent_key}}/${PROXY_AGENT_KEY}/g" ${cert_yaml}
</details> </details>
Run the following command to run the script: Run the following commands to run the script:
```shell ```shell
chmod +x replace-proxy-agent.sh chmod +x replace-proxy-agent.sh
bash replace-proxy-agent.sh bash replace-proxy-agent.sh
``` ```
Deploying the proxy-agent in the pull mode member cluster (in this example, cluster member3 cluster is in pull mode.): Deploy the proxy-agent in the pull mode for a member cluster (in this example, the `member3` cluster is in the pull mode.):
```shell ```shell
kind load docker-image swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-agent:0.0.24 --name member3 kind load docker-image swr.ap-southeast-1.myhuaweicloud.com/karmada/proxy-agent:0.0.24 --name member3
kubectl --kubeconfig=/root/.kube/members.config --context=member3 apply -f proxy-agent.yaml kubectl --kubeconfig=/root/.kube/members.config --context=member3 apply -f proxy-agent.yaml
``` ```
**The ANP deployment is complete.**
### Step 6: Add command flags for karmada-agent deployment **The ANP deployment is complete now.**
After deploying the ANP deployment, we need to add extra command flags `--cluster-api-endpoint` and `--proxy-server-address` for `karmada-agent` deployment in `member3` cluster. ### Step 6: Add command flags for the karmada-agent deployment
After deploying the ANP deployment, you need to add extra command flags `--cluster-api-endpoint` and `--proxy-server-address` for the `karmada-agent` deployment in the `member3` cluster.
Where `--cluster-api-endpoint` is the APIEndpoint of the cluster. You can obtain it from the KubeConfig file of the `member3` cluster. Where `--cluster-api-endpoint` is the APIEndpoint of the cluster. You can obtain it from the KubeConfig file of the `member3` cluster.
Where `--proxy-server-address` is the address of the proxy server that is used to proxy the cluster. In current case, we can set `--proxy-server-address` to `http://<karmada_controlplan_addr>:8088`. Get `karmada_controlplan_addr` value through the following command: Where `--proxy-server-address` is the address of the proxy server that is used to proxy the cluster. In current case, you can set `--proxy-server-address` to `http://<karmada_controlplan_addr>:8088`. Get `karmada_controlplan_addr` value through the following command:
```shell ```shell
docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' karmada-host-control-plane docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' karmada-host-control-plane
``` ```
Port `8088` is set by our code modification in ANP: https://github.com/mrlihanbo/apiserver-network-proxy/blob/v0.0.24/dev/cmd/server/app/server.go#L267. You can also modify it to a different value.
Set port `8088` by modifying the code in ANP: https://github.com/mrlihanbo/apiserver-network-proxy/blob/v0.0.24/dev/cmd/server/app/server.go#L267. You can also modify it to a different value.