Manually Setup

This tutorial shows how to setup OpenYurt cluster manually. We assume you already have a Kubernetes cluster setup properly. If you want to create an OpenYurt cluster from scratch, please refer to yurtadm docs.

1. Precondition

Make sure you already have a Kubernetes cluster with at least one node. We recommend to create your Kubernetes cluster with kubeadm tool.

  1. $ kubectl get nodes
  2. NAME STATUS ROLES AGE VERSION
  3. izwz9dohcv74iegqecp4axz Ready control-plane,master 6d1h v1.22.11

1.1 Label cloud nodes

When disconnected from the apiserver, only the pod running on the autonomous edge node will be prevented from being evicted from nodes. Therefore, we first need to divide nodes into two categories, the cloud node and the edge node, by using label openyurt.io/is-edge-worker. we will use node izwz9dohcv74iegqecp4axz as the cloud node. We label the cloud node with value false,

  1. $ kubectl label node izwz9dohcv74iegqecp4axz openyurt.io/is-edge-worker=false
  2. izwz9dohcv74iegqecp4axz labeled

2. OpenYurt Setup Pre-requirement

  • The IP addresses of all nodes in the cluster must be different
  • You must make the following adjustments if using docker as container runtime, which is mainly to avoid docker modifying the iptables forward chain and damaged the node forward.

    1. iptables -w -P FORWARD ACCEPT
    2. sed -i 's#^After=network-online.target firewalld.service$#After=network-online.target firewalld.service containerd.service#g' \
    3. /lib/systemd/system/docker.service
  • Domain Name resolution from pods on edge nodes will be handled by CoreDNS instance on master node or cloud node through VPN tunnel that provided by Raven, so some resolution latency or timeout will be caused by network. we recommend you to adjust CoreDNS Deployment according to CoreDNS Adjustment tutorial if you care about latency or timeout.

3. Setup Control-Plane components of OpenYurt

We recommend to install OpenYurt components with Helm, please make sure that helm CLI has been installed properly before moving on. All the helm charts used in this tutorial can be found in openyurt-helm repo.

3.1 Setup openyurt/yurt-app-manager components

3.1.1 Install yurt-app-manager

Yurt-App-Manager is a functional component that provides united edge management capabilities for an OpenYurt cluster. You can install this component with helm.

  1. helm install yurt-app-manager -n kube-system ./charts/yurt-app-manager --set image.tag=latest

You can check if yurt-app-manager pod and service have been installed successfully with:

  1. kubectl get pod -n kube-system | grep yurt-app-manager
  2. kubectl get svc -n kube-system | grep yurt-app-manager

3.1.2 Create NodePool

To better manage the nodes and the traffic on the nodes (e.g., Service traffic topology management), we recommend putting the nodes of the Layer 2 network interworking in the same node pool. In this example, a node pool is created for cloud side as follows:

  1. cat <<EOF | kubectl apply -f -
  2. apiVersion: apps.openyurt.io/v1beta1
  3. kind: NodePool
  4. metadata:
  5. name: master
  6. spec:
  7. type: Cloud
  8. EOF

3.1.3 Add node into NodePool

Add the cloud node into nodepool created in 3.1.2:

  1. $ kubectl label node izwz9dohcv74iegqecp4axz apps.openyurt.io/desired-nodepool=master
  2. izwz9dohcv74iegqecp4axz labeled

3.2 Setup openyurt/yurt-controller-manager components

  • yurt-controller-manager: it prevents apiserver from evicting pods running on the autonomous edge nodes during disconnection.

We can install all the components above with helm:

  1. cat <<EOF | helm install openyurt ./charts/openyurt -n kube-system -f -
  2. yurtControllerManager:
  3. image:
  4. tag: latest
  5. EOF

If everthing went well, you’ll see something like this after typing helm list -A

  1. $ helm list -A
  2. NAME NAMESPACE REVISION UPDATED STATUS CHART APP VERSION
  3. openyurt kube-system 1 2022-09-07 17:06:17.764754411 +0800 CST deployed openyurt-1.0.0 1.0.0
  4. yurt-app-manager kube-system 1 2022-09-07 17:36:30.371904902 +0800 CST deployed yurt-app-manager-0.1.2 0.8.0

4. Setup Cross-Network-Domain Communication components of OpenYurt

Raven provides network communication capabilities when the cloud and the edge are in different network areas, which include two components raven-controller-manager and raven-agent.

4.1 Setup raven-controller-manager component

raven-controller-manager is a standard kubernetes controller for the Gateway, a custom cluster resource, deployed on cloud nodes (which can be master or Cloud nodes). Gateway CR manages nodes in different physical zones and dynamically elects a qualified node in the physical zone as a Gateway node.

  1. git clone https://github.com/openyurtio/raven-controller-manager.git
  2. cd raven-controller-manager
  3. git checkout v0.3.0
  4. make generate-deploy-yaml
  5. kubectl apply -f _output/yamls/raven-controller-manager.yaml

4.2 Setupraven-agent component

  1. git clone https://github.com/openyurtio/raven.git
  2. cd raven
  3. git checkout v0.3.0
  4. FORWARD_NODE_IP=true make deploy

5. Attention

The above operation is only for the Master node, if there are other nodes in the cluster, additional adjustment is needed, the operation method can be referred to Install OpenYurt Node on Existing K8s Nodes.