Skip to content

Commit

Permalink
Fix for Installation ReadMe
Browse files Browse the repository at this point in the history
Signed-off-by: Kfir Toledo <[email protected]>
  • Loading branch information
kfirtoledo committed Nov 14, 2023
1 parent 52675f9 commit f5e02e3
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 36 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ Here are the key steps for setting up your developer environment, making a chang
### How to setup and run ClusterLink

ClusterLink can be set up and run on different environments: local environment (Kind),
Bare-metal environment, or cloud environment.For more details, refer to the [Installation Guide for ClusterLink](docs/Installation.md).
Bare-metal environment, or cloud environment. For more details, refer to the [Installation Guide for ClusterLink](docs/Installation.md).

#### Run ClusterLink in local environment (Kind)

Expand Down
20 changes: 11 additions & 9 deletions demos/iperf3/kind/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ In this step, we build the Kind cluster with the gateway image.
Create certificates and deployments files:
1) Create folder for all deployments and yaml files:

export TEST_DIR=$PROJECT_DIR/bin/test/iperf3/
mkdir -p $TEST_DIR
cd $TEST_DIR
export DEPLOY_DIR=~/clusterlink-deployment
mkdir -p $DEPLOY_DIR
cd $DEPLOY_DIR

2) Create fabric certificates (includes the Root CA certificate fo all the gateways):

Expand All @@ -51,7 +51,7 @@ Build the first Kind cluster with gateway, and iperf3-client:

2) Deploy ClusterLink gateway deployment:

kubectl apply -f $TEST_DIR/peer1/k8s.yaml
kubectl apply -f $DEPLOY_DIR/peer1/k8s.yaml

3) Expose ClusterLink gateway port using K8s nodeport service:

Expand All @@ -70,7 +70,7 @@ Build the second Kind cluster with gateway, and iperf3-client:

2) Deploy Clustrelink gateway deployment:

kubectl apply -f $TEST_DIR/peer2/k8s.yaml
kubectl apply -f $DEPLOY_DIR/peer2/k8s.yaml

3) Expose ClusterLink gateway port using K8s nodeport service:

Expand All @@ -83,7 +83,9 @@ Build the second Kind cluster with gateway, and iperf3-client:

Check that container statuses are Running.

kubectl get pods
kubectl rollout status deployment cl-controlplane
kubectl rollout status deployment cl-dataplane
kubectl wait --for=condition=ready pod -l app=gwctl

### Step 3: Start gwctl
In this step, we set up the gwctl.
Expand All @@ -96,17 +98,17 @@ First, Initialize the Gateways IPs:

Initialize gwctl CLI for peer1:

gwctl init --id "peer1" --gwIP $PEER1_IP --gwPort 30443 --certca $TEST_DIR/cert.pem --cert $TEST_DIR/peer1/gwctl/cert.pem --key $TEST_DIR/peer1/gwctl/key.pem
gwctl init --id "peer1" --gwIP $PEER1_IP --gwPort 30443 --certca $DEPLOY_DIR/cert.pem --cert $DEPLOY_DIR/peer1/gwctl/cert.pem --key $DEPLOY_DIR/peer1/gwctl/key.pem

Initialize gwctl CLI for peer2:

gwctl init --id "peer2" --gwIP $PEER2_IP --gwPort 30443 --certca $TEST_DIR/cert.pem --cert $TEST_DIR/peer2/gwctl/cert.pem --key $TEST_DIR/peer2/gwctl/key.pem
gwctl init --id "peer2" --gwIP $PEER2_IP --gwPort 30443 --certca $DEPLOY_DIR/cert.pem --cert $DEPLOY_DIR/peer2/gwctl/cert.pem --key $DEPLOY_DIR/peer2/gwctl/key.pem

Note : Another approach is to use the gwctl inside the kind cluster. In this case, the gwctl is already set up and deployed.
(If you are using macOS this is the better approach).
In this case, you should replace the gwctl command with:

kubectl exec -i <gwctl_pod> -- gwctl <the command>
kubectl exec -i <gwctl_pod> -- gwctl <command>

See example in the next step.

Expand Down
60 changes: 34 additions & 26 deletions docs/Installation.md
Original file line number Diff line number Diff line change
@@ -1,50 +1,54 @@
# Installation Guide for ClusterLink
The ClusterLink gateway contains three main components: the control-plane, data-plane, and gwctl (more details can be found [here](../README.md#what-is-clusterlink)).

ClusterLink can be deployed in a local environment (Kind) or any remote K8s cluster environment (GKE, EKS, IBM-K8S, etc.).
ClusterLink can be deployed in a local environment (e.g., Kind) or any remote K8s cluster environment (e.g., google GKE, amazon EKS, IBM IKS, etc.).

To deploy the ClusterLink gateway in a K8s cluster, follow these steps:

1. Create and deploy certificates and the ClusterLink Deployment file.
1. Create and deploy certificates and the ClusterLink deployment YAML file.
2. Expose the ClusterLink deployment to a public IP.
3. Optionally, create a central gwctl component to control all gateways.
3. Optionally, create a central gwctl component to control one or more gateways.

Before you begin, please clone and build the project according to the [instructions](../README.md#building-clustelink).
### 1. ClusterLink Deployment and certificates.
In this step, we build the ClusterLink certificates and deployment files.
Before you begin, please build the project according to the [instructions](../README.md#building-clustelink).
### 1. ClusterLink deployment and certificates
In this step, we create the ClusterLink certificates and deployment files.

1) Create a folder (eg. TEST_DIR) for all deployments and yaml files:
1) Create a folder (eg. DEPLOY_DIR) for all deployments and yaml files:

export PROJECT_DIR=`git rev-parse --show-toplevel`
export TEST_DIR=$PROJECT_DIR/bin/test/
mkdir -p $TEST_DIR
cd $TEST_DIR
export DEPLOY_DIR=~/clusterlink-deployment
mkdir -p $DEPLOY_DIR
cd $DEPLOY_DIR

2) Create Fabric certificates, including the Root CA certificate for all the clusters (This step needs to be done only once per fabric).:
2) Create fabric certificate, which is the root CA certificate for all the clusters:

$PROJECT_DIR/bin/cl-adm create fabric

3) Create certificates and a deployment file for the cluster (e.g., peer1). This step needs to be performed for every K8s cluster.:
Note: This step needs to be done only once per fabric.
3) Create certificates and a deployment file for the cluster (e.g., peer1):

$PROJECT_DIR/bin/cl-adm create peer --name peer1

Note: By default, the images are pulled from ghcr.io/clusterlink-net. To change the container registry, you can use the ```--container-registry``` flag.
Note: By default, the images are pulled from ghcr.io/clusterlink-net. To change the container registry, you can use the ```--container-registry``` flag.
This step needs to be performed for every K8s cluster.

4) Apply ClusterLink deployment:

kubectl apply -f $TEST_DIR/peer1/k8s.yaml

kubectl apply -f $DEPLOY_DIR/peer1/k8s.yaml

5) Verify that all components (cl-controlplane, cl-dataplane, gwctl) are set up and ready.

kubectl get pods
kubectl rollout status deployment cl-controlplane
kubectl rollout status deployment cl-dataplane
kubectl wait --for=condition=ready pod -l app=gwctl

### 2. Expose the ClusterLink deployment to a public IP
Create public IP for accessing the ClusterLink gateway.
For Local environment create a K8s nodeport service:
Create a public IP for accessing the ClusterLink gateway.
For a local environment create a K8s nodeport service:

kubectl apply -f $PROJECT_DIR/demos/utils/manifests/kind/cl-svc.yaml
export PEER1_IP=`kubectl get nodes -o "jsonpath={.items[0].status.addresses[0].address}"`
export PEER1_PORT=30443

For a remote environment:

Expand All @@ -56,17 +60,18 @@ For a remote environment:
2. Retrieve the LoadBalancer IP when it is allocated:
```
export PEER1_IP=$(kubectl get svc -l app=cl-dataplane -o jsonpath="{.items[0].status.loadBalancer.ingress[0].ip}")
export PEER1_PORT=443
```
Now, the ClusterLink gateway can be accessed through `$PEER1_IP` at port 443.
Now, the ClusterLink gateway can be accessed through `$PEER1_IP` at port `$PEER1_PORT`.
### 3. Create central gwctl (optional)
### 3. Create a central gwctl (optional)
By default for each K8s cluster a gwctl pod is created that use REST APIs to send control messages to the
ClusterLink Gateway, using the command:
ClusterLink gateway, using the command:
kubectl exec -i <gwctl_pod> -- gwctl <the command>
kubectl exec -i <gwctl_pod> -- gwctl <command>
To create a single gwctl that controls all ClusterLink gateways, follow these steps:
To create a single gwctl that controls one or more ClusterLink gateways, follow these steps:
1. Install the local control (gwctl):
Expand All @@ -76,18 +81,21 @@ To create a single gwctl that controls all ClusterLink gateways, follow these st
2. Initialize the gwctl CLI for the cluster (e.g., peer1):
```
gwctl init --id "peer1" --gwIP $PEER1_IP --gwPort 30443 --certca $TEST_DIR/cert.pem --cert $TEST_DIR/peer1/gwctl/cert.pem --key
gwctl init --id "peer1" --gwIP $PEER1_IP --gwPort 30443 --certca $DEPLOY_DIR/cert.pem --cert $DEPLOY_DIR/peer1/gwctl/cert.pem --key
```
## Additional Setup Modes
### Debug mode
To run ClusterLink component in debug mode, use ```--log-level``` flag when creating the ClusterLink deployment
To run ClusterLink components in debug mode, use ```--log-level``` flag when creating the ClusterLink deployment
$PROJECT_DIR/bin/cl-adm create peer --name peer1 --log-level debug
### Local docker image
### Running self-built images
To create and run a local image, first build the project's local images:
make docker-build
Change the container-registry in the peer deployment to use the local image:
$PROJECT_DIR/bin/cl-adm create peer --name peer1 --container-registry=""

0 comments on commit f5e02e3

Please sign in to comment.