### Install Kube-OVN Helm Chart from Source (High Availability) Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Install the Kube-OVN Helm chart from a local source directory for a highly available setup. List multiple master nodes separated by commas. ```bash helm install --debug kubeovn ./charts/kube-ovn --set MASTER_NODES=${Node0},${Node1},${Node2} ``` -------------------------------- ### Install Kube-OVN v2 Chart from Source Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Install the Kube-OVN v2 Helm chart by providing the local path to the chart source. ```bash helm install kube-ovn ./charts/kube-ovn-v2 ``` -------------------------------- ### Install Kubeadm and Kubelet on Windows Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 Execute the PrepareNode.ps1 script on Windows nodes to install kubeadm and kubelet. Specify the Kubernetes version and container runtime. ```powershell .\PrepareNode.ps1 -KubernetesVersion v1.22.9 -ContainerRuntime Docker ``` -------------------------------- ### Install Kube-OVN with Helm Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Install Kube-OVN using Helm, applying a custom values.yaml file for single-replica OVN-central configuration. ```bash helm install kube-ovn ./charts/kube-ovn -f values.yaml ``` -------------------------------- ### Deploy Sample Pod Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Deploy a sample Nginx pod to observe network behavior after installation. ```bash kubectl run nginx --image=nginx ``` -------------------------------- ### Download CES Installation Script Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/2.CES安装 Use wget to download the CES installation script from the specified URL. ```bash wget https://raw.githubusercontent.com/f5devcentral/container-egress-service/master/dist/install.sh ``` -------------------------------- ### Download Kube-OVN Installation Script Source: https://github.com/kubeovn/kube-ovn/wiki/Underlay-网络支持 Use this command to download the installation script for Kube-OVN. Ensure you are using a version that supports Underlay mode. ```bash wget https://raw.githubusercontent.com/kubeovn/kube-ovn/release-1.10/dist/images/install.sh ``` -------------------------------- ### Install Kube-OVN Helm Chart from Source (Standard) Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Install the Kube-OVN Helm chart from a local source directory. Specify the master nodes using the MASTER_NODES variable. ```bash helm install --debug kubeovn ./charts/kube-ovn --set MASTER_NODES=${Node0} ``` -------------------------------- ### Install Kube-OVN Helm Chart from OCI Registry Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Use this command to install the Kube-OVN Helm chart directly from the GitHub Container Registry. ```bash helm install kube-ovn oci://ghcr.io/kubeovn/charts/kube-ovn --version v1.15.0 ``` -------------------------------- ### Install Hyper-V and related features Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 If Hyper-V is not installed or functional, use these PowerShell and DISM commands to install the necessary features. A system restart is required. ```powershell Install-WindowsFeature containers Install-WindowsFeature Hyper-V-Powershell dism /online /enable-feature /featurename:Microsoft-Hyper-V /all /NoRestart dism /online /disable-feature /featurename:Microsoft-Hyper-V-Online /NoRestart Restart-Computer ``` -------------------------------- ### List kubectl Plugins Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Verify that the kubectl-ko plugin has been successfully installed and is recognized by kubectl. ```bash [root@kube-ovn01 ~]# kubectl plugin list The following compatible plugins are available: /usr/local/bin/kubectl-ko ``` -------------------------------- ### Install Kube-OVN v2 Chart from OCI Registry Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Use this command to install the Kube-OVN v2 Helm chart directly from the GitHub Container Registry. ```bash helm install kube-ovn oci://ghcr.io/kubeovn/charts/kube-ovn-v2 --version v1.17.0 ``` -------------------------------- ### Install Kube-OVN with install.sh for Single-replica Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Deploy Kube-OVN using the install.sh script with environment variables to enable single-replica OVN-central and specify storage class and size. ```bash ENABLE_SINGLE_REPLICA_OVN=true \ OVN_CENTRAL_STORAGE_CLASS=my-csi \ OVN_CENTRAL_PVC_SIZE=10Gi \ bash dist/images/install.sh ``` -------------------------------- ### Install Kube-OVN Helm Chart on Talos Linux Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Use these Helm chart options when installing on Talos Linux. These settings adjust directory paths and disable module management. ```bash --set cni_conf.MOUNT_LOCAL_BIN_DIR=false --set OPENVSWITCH_DIR=/var/lib/openvswitch --set OVN_DIR=/var/lib/ovn --set DISABLE_MODULES_MANAGEMENT=true ``` -------------------------------- ### Prepare Nodes for Kube-OVN Installation Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md These commands are used to label nodes before installing the Kube-OVN Helm chart from source. Ensure nodes are correctly identified for OS, control plane, and OVS DP type. ```bash kubectl label node -lbeta.kubernetes.io/os=linux kubernetes.io/os=linux --overwrite kubectl label node -lnode-role.kubernetes.io/control-plane kube-ovn/role=master --overwrite kubectl label node -lovn.kubernetes.io/ovs_dp_type!=userspace ovn.kubernetes.io/ovs_dp_type=kernel --overwrite ``` -------------------------------- ### Install Kube-OVN with install.sh for Exposed Services Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Use the install.sh script with environment variables to enable single-replica OVN-central and configure the OVN DB services as LoadBalancer type. This is for exposing the DB to tenant clusters. ```bash ENABLE_SINGLE_REPLICA_OVN=true \ OVN_CENTRAL_STORAGE_CLASS=my-csi \ OVN_CENTRAL_SERVICE_TYPE=LoadBalancer \ OVN_CENTRAL_LB_IP=10.99.99.99 \ OVN_CENTRAL_EXTERNAL_TRAFFIC_POLICY=Local \ bash dist/images/install.sh ``` -------------------------------- ### Install Requirements for RPM-based OS Source: https://github.com/kubeovn/kube-ovn/blob/master/fastpath/README.md Installs necessary development tools and kernel headers matching the running kernel version. Ensure the kernel-header version is identical to that used on your Kubernetes nodes. ```bash yum install -y kernel-devel-$(uname -r) gcc elfutils-libelf-devel ``` -------------------------------- ### Install OVN and Kube-OVN on Windows Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 Run the install.ps1 script on Windows nodes to install OVN and Kube-OVN. Provide the path to your kubeconfig file, the API server address, and the Service CIDR. ```powershell .\install.ps1 -KubeConfig C:\k\admin.conf -ApiServer https://192.168.140.180:6443 -ServiceCIDR 10.96.0.0/12 ``` -------------------------------- ### Install Requirements for DEB-based OS Source: https://github.com/kubeovn/kube-ovn/blob/master/fastpath/README.md Installs necessary development tools and kernel headers matching the running kernel version. Ensure the kernel-header version is identical to that used on your Kubernetes nodes. ```bash apt install linux-headers-$(uname -r) make gcc-12 ``` -------------------------------- ### Execute CES Installation Script Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/2.CES安装 Run the install.sh script using bash to deploy the Container Egress Service. ```bash bash install.sh ``` -------------------------------- ### Install Kube-OVN Data-Plane Release Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/kamaji-deployment.md Installs the Kube-OVN data-plane release on the tenant cluster using Helm, pointing to the management cluster's load balancer. ```bash helm install --kube-context=tenant kube-ovn ./charts/kube-ovn -f tenant-values.yaml ``` -------------------------------- ### Verify Single-replica OVN-Central Deployment Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Check the number of OVN-central pods, the PVC, and the service selector to confirm a successful single-replica deployment. This helps ensure the setup is correct after installation. ```bash kubectl get pod -n kube-system -l app=ovn-central # should be 1 pod kubectl get pvc -n kube-system ovn-central-data kubectl get svc -n kube-system ovn-nb -o jsonpath='{.spec.selector}' # Expected: {"app":"ovn-central"} — no ovn-nb-leader selector ``` -------------------------------- ### Install Kube-OVN on Management Cluster Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/kamaji-deployment.md Command to deploy Kube-OVN using Helm on the management cluster with the specified values file. ```bash helm install --kube-context=mgmt kube-ovn ./charts/kube-ovn -f mgmt-values.yaml ``` -------------------------------- ### Get Nodes Wide Output Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 After successfully adding a Windows node to the cluster, use this kubectl command to view detailed node information. ```bash kubectl get nodes -o wide ``` -------------------------------- ### Install the FastPath Module on Kubernetes Nodes Source: https://github.com/kubeovn/kube-ovn/blob/master/fastpath/README.md Copies the compiled kernel module file to your Kubernetes nodes and loads it into the running kernel. This command assumes the module file `kube_ovn_fastpath.ko` is in the current directory. ```bash insmod kube_ovn_fastpath.ko ``` -------------------------------- ### Configure Talos Linux for Kube-OVN Helm Chart Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Declare the openvswitch module in the Talos Linux machine configuration. This is a prerequisite for installing the Helm chart on Talos. ```yaml machine: kernel: modules: - name: openvswitch ``` -------------------------------- ### Configure ExternalService with Bandwidth Limit Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/5.CES-namespace策略配置 Define an ExternalService resource for a specific namespace, including its target addresses and ports. This example also demonstrates how to apply a bandwidth limit by referencing an 'irule' from the ConfigMap. ```yaml apiVersion: kubeovn.io/v1alpha1 kind: ExternalService metadata: name: ns600-baidu-bwc namespace: ns-600 spec: addresses: - www.baidu.com ports: - bandwidth: bwc-2mbps-irule name: tcp-80 port: "80" protocol: TCP ``` -------------------------------- ### Verify FastPath Module Installation with dmesg Source: https://github.com/kubeovn/kube-ovn/blob/master/fastpath/README.md Checks the kernel message log for confirmation that the `kube_ovn_fastpath` module has been successfully initialized. Look for output indicating successful initialization of the module's hooks. ```bash [619631.323788] init_module,kube_ovn_fastpath_local_out [619631.323798] init_module,kube_ovn_fastpath_post_routing [619631.323800] init_module,kube_ovn_fastpath_pre_routing [619631.323801] init_module,kube_ovn_fastpath_local_in ``` -------------------------------- ### Check Open vSwitch Service Status Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 Verify that the Open vSwitch database and switch services are running correctly after installation using this PowerShell command. ```powershell PS > Get-Service | findstr ovs ``` -------------------------------- ### Get Pod Information Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Retrieve detailed information about the deployed pods, including their IP addresses and node assignments. ```bash [root@node2 yamls]# kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-74d5899f46-x5ghb 1/1 Running 0 2m58s 10.16.0.2 node1 ``` -------------------------------- ### Kube-OVN v2 Chart Options for Talos Linux Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Specify these options when installing the Kube-OVN v2 chart on Talos Linux. ```yaml ovsOvn: disableModulesManagement: true ovsDirectory: "/var/lib/openvswitch" ovnDirectory: "/var/lib/ovn" cni: mountToolingDirectory: false ``` -------------------------------- ### F5 CES Controller ConfigMap Example Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/3.控制器Configmap设定 This ConfigMap defines F5-specific settings for the CES controller, including virtual server templates, gateway pools, and route domain configurations. The `gwPool` parameter is mandatory when specifying a route domain. ```yaml kind: ConfigMap metadata: name: ces-controller-configmap namespace: kube-system data: ces.conf: | - name: "p1" namespaces: "ns-800" routeDomain: id: 1 name: "rd1" virtualService: template: '' gwPool: serverAddresses: - "172.16.10.254" initialized: "false" ``` -------------------------------- ### Upgrade Kube-OVN Helm Chart from Source Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn/README.md Upgrade an existing Kube-OVN Helm installation to the current version from a local source directory. Specify master nodes if necessary. ```bash helm upgrade --debug kubeovn ./charts/kube-ovn --set MASTER_NODES=${Node0},${Node1},${Node2} ``` -------------------------------- ### Enable Test Signing for Open vSwitch Source: https://github.com/kubeovn/kube-ovn/wiki/Windows-支持 These bcdedit commands are required to enable test signing mode on Windows, which is necessary for installing Open vSwitch for Hyper-V. A system restart is required for these changes to take effect. ```powershell bcdedit /set LOADOPTIONS DISABLE_INTEGRITY_CHECKS bcdedit /set TESTSIGNING ON bcdedit /set nointegritychecks ON ``` -------------------------------- ### Return Errors from Functions (Go) Source: https://github.com/kubeovn/kube-ovn/blob/master/CODE_STYLE.md Functions should return errors when they occur, rather than skipping them silently. This example shows a function that incorrectly handles an error versus one that properly returns it. ```go func startHandle() { if err = some(); err != nil { klog.Errorf(err) } return } ``` ```go func startHandle() error { if err = some(); err != nil { klog.Errorf(err) return err } return nil } ``` -------------------------------- ### Define Namespace Egress Rule for Another Service Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/5.CES-namespace策略配置 This example shows another NamespaceEgressRule configuration, allowing access to a different ExternalService within its respective namespace. It follows the same pattern of specifying the action and the target external service. ```yaml apiVersion: kubeovn.io/v1alpha1 kind: NamespaceEgressRule metadata: name: ns700-allow-icbc-api namespace: ns-700 spec: action: accept-decisively externalServices: - ns700-icbc-api ``` -------------------------------- ### Simulate Failover Drill for Single-replica OVN-Central Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Perform a failover drill by cordoning the current OVN-central node and deleting the pod, then waiting for a new pod to become ready on a different node. This tests the resilience of the single-replica setup. ```bash node=$(kubectl get pod -n kube-system -l app=ovn-central \ -o jsonpath='{.items[0].spec.nodeName}') # Simulate node loss kubectl cordon "$node" kubectl delete pod -n kube-system -l app=ovn-central # Wait for the new pod to come up on a different node and the DB to respond kubectl wait pod -n kube-system -l app=ovn-central \ --for=condition=Ready --timeout=5m kubectl exec -n kube-system -l app=ovn-central -- ovn-nbctl show ``` -------------------------------- ### Download and Make KNB Executable Source: https://github.com/kubeovn/kube-ovn/blob/master/test/performance/README.md Download the KNB binary and make it executable. This is the first step before running any performance tests. ```bash wget https://raw.githubusercontent.com/InfraBuilder/k8s-bench-suite/master/knb chmod +x knb ``` -------------------------------- ### Deploy Kube-OVN and Test Server Source: https://github.com/kubeovn/kube-ovn/blob/master/test/server/README.md Commands to initialize a Kind cluster, deploy Kube-OVN, build and deploy the test server, and obtain its IP address. ```bash # Deploy a kubernetes cluster with kube-ovn make kind-init kind-install # Build and deploy test-server make image-test kind load docker-image --name kube-ovn kubeovn/test:v1.13.0 kubectl apply -f test/server/test-server.yaml docker run --name kube-ovn-test -d --net=kind kubeovn/test:v1.13.0 docker inspect kube-ovn-test -f '{{.NetworkSettings.Networks.kind.IPAddress}}' ``` -------------------------------- ### Download kubectl-ko Plugin Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Download the kubectl-ko plugin binary. Ensure you are using the correct URL for the desired release. ```bash wget https://raw.githubusercontent.com/kubeovn/kube-ovn/release-1.10/dist/images/kubectl-ko ``` -------------------------------- ### Build and Run E2E Tests in CI/CD Source: https://github.com/kubeovn/kube-ovn/blob/master/test/e2e/non-primary-cni/README.md Illustrates the build and execution phases for integrating Kube-OVN non-primary CNI E2E tests into CI/CD pipelines using Ginkgo. ```bash # Build Phase: ginkgo build compiles the test binary # Execution Phase: Tests run on KIND clusters with appropriate timeout settings # Reporting Phase: Ginkgo generates XML/JSON reports for CI systems ``` -------------------------------- ### Run Unit Tests Source: https://github.com/kubeovn/kube-ovn/blob/master/AGENTS.md Execute this command to run unit tests, including Ginkgo suites in test/unittest and Go tests with coverage for pkg. ```bash make ut ``` -------------------------------- ### Move kubectl-ko to PATH Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Move the downloaded kubectl-ko binary to a directory included in your system's PATH for easy access. ```bash mv kubectl-ko /usr/local/bin/kubectl-ko ``` -------------------------------- ### Configure Install.sh Variables Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/2.CES安装 Edit the install.sh script to set environment variables for Big-IP connection and Kubernetes namespace. Ensure sensitive information like passwords is handled securely. ```bash BIGIP_URL=${BIGIP_URL:-192.168.50.254} # IP address of Big-IP server. CES pod will connect this IP. BIGIP_USERNAME=${BIGIP_USERNAME:-admin} # BigIP username BIGIP_PASSWORD=${BIGIP_PASSWORD:-yourpassword} # BigIP password BIGIP_INSECURE=${BIGIP_INSECURE:-true} # ignore Big-IP TLS error K8S_NAMESPACE=${K8S_NAMESPACE:-kube-system} # namespace in which the controller will be deployed. This ns # also will be for global policy ``` -------------------------------- ### Handle Errors with Logging (Go) Source: https://github.com/kubeovn/kube-ovn/blob/master/CODE_STYLE.md Unexpected errors should be logged using klog.Errorf and returned. Skipping errors silently is not allowed. This demonstrates proper error handling when initializing a Kubernetes client. ```go kubeClient, _ := kubernetes.NewForConfig(cfg) ``` ```go kubeClient, err := kubernetes.NewForConfig(cfg) if err != nil { klog.Errorf("init kubernetes client failed %v", err) return err } ``` -------------------------------- ### Kubelet Configuration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Configure Kubelet settings, including its operating directory and the directory for logs. ```yaml {} ``` ```json "/var/lib/kubelet" ``` ```json "/var/log" ``` -------------------------------- ### OVS/OVN Node Selector Configuration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Specify a node selector to restrict the deployment of ovs-ovn components to specific nodes, for example, Linux nodes. ```json { "kubernetes.io/os": "linux" } ``` -------------------------------- ### OVS/OVN DaemonSet Update Strategy Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Define the update strategy for the ovs-ovn DaemonSet, controlling how pods are updated during rollouts. This example uses a RollingUpdate strategy. ```json { "maxSurge": 1, "maxUnavailable": 0, "type": "RollingUpdate" } ``` -------------------------------- ### Configure Underlay Network Parameters in install.sh Source: https://github.com/kubeovn/kube-ovn/wiki/Underlay-网络支持 Modify these variables within the install.sh script to configure Underlay network settings. This includes network type, interface, VLAN ID, Pod CIDR, gateway, and excluded IP ranges. ```bash NETWORK_TYPE 设置为 vlan VLAN_INTERFACE_NAME 设置为宿主机上承担容器流量的网卡,例如 eth1 VLAN_ID 设置为 0 POD_CIDR 设置为物理网络 CIDR, 例如 192.168.1.0/24 POD_GATEWAY 设置为物理网络网关,例如192.168.1.1 EXCLUDE_IPS 排除范围,避免容器网段和物理网络已用 IP 冲突,例如 192.168.1.1..192.168.1.100 ``` -------------------------------- ### Helm Values for Single-replica OVN-Central Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md Configure OVN-central for single-replica deployment by setting OVN_CENTRAL_MODE to 'single' and specifying storage details. This is used when installing Kube-OVN via Helm. ```yaml # values.yaml OVN_CENTRAL_MODE: single ovn-central: storage: storageClassName: my-csi # leave empty to use the cluster default size: 10Gi accessModes: - ReadWriteOnce # existingClaim: "" # set to use a pre-created PVC instead ``` -------------------------------- ### Management Cluster Helm Values for Kube-OVN Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/kamaji-deployment.md Configuration for installing Kube-OVN in `controlPlaneOnly` mode on the management cluster. Ensure `storageClassName`, `loadBalancerIP`, and `ENABLE_SSL` are set appropriately for your environment. ```yaml namespace: kube-system installMode: controlPlaneOnly OVN_CENTRAL_MODE: single ovn-central: storage: storageClassName: my-csi size: 10Gi service: type: LoadBalancer loadBalancerIP: 10.99.99.99 # provider-dependent; omit for auto externalTrafficPolicy: Local # preserves tenant source IPs (optional) networking: ENABLE_SSL: true # strongly recommended ``` -------------------------------- ### Make kubectl-ko Executable Source: https://github.com/kubeovn/kube-ovn/wiki/手动安装 Grant execute permissions to the kubectl-ko binary so it can be run as a command. ```bash chmod +x /usr/local/bin/kubectl-ko ``` -------------------------------- ### Create Tenant Subnet and Verify IP Assignment Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/kamaji-deployment.md Performs a sanity check by creating a new tenant Subnet and observing if a pod successfully obtains an IP address from the assigned CIDR. ```bash # Sanity: create a tenant Subnet, watch a pod get an IP kubectl --context=tenant create -f - < kube-ovn-tls.yaml ``` -------------------------------- ### Tidy Modules and Compile Go Binaries Source: https://github.com/kubeovn/kube-ovn/blob/master/AGENTS.md Run this command to tidy Go modules and compile binaries for linux/amd64, placing them in dist/images/. Ensure this is run after editing code. ```bash make build-go ``` -------------------------------- ### Run Basic KNB Performance Test Source: https://github.com/kubeovn/kube-ovn/blob/master/test/performance/README.md Execute a basic performance test using KNB. Replace {Client NodeName} and {Server NodeName} with the actual names of your client and server nodes. The test duration is set to 60 seconds. ```bash ./knb -v -cn {Client NodeName} -sn {Server NodeName} --duration 60 ``` -------------------------------- ### Inline Error Checking (Go) Source: https://github.com/kubeovn/kube-ovn/blob/master/CODE_STYLE.md Prefer checking errors inline using the `if err := function(); err != nil {}` pattern for conciseness. This example contrasts a multi-line check with the preferred inline method. ```go err := c.initNodeRoutes() if err != nil { klog.Fatalf("failed to initialize node routes: %v", err) } ``` ```go if err := c.initNodeRoutes(); err != nil { klog.Fatalf("failed to initialize node routes: %v", err) } ``` -------------------------------- ### Run Linter and Go Modernize Source: https://github.com/kubeovn/kube-ovn/blob/master/AGENTS.md Execute this command to run golangci-lint and Go 'modernize'. It automatically fixes lint issues when not in a CI environment. Always run this after editing code. ```bash make lint ``` -------------------------------- ### Create VLAN CRD for Underlay Network Source: https://github.com/kubeovn/kube-ovn/wiki/Underlay-网络支持 Define a Vlan Custom Resource Definition (CRD) to specify the VLAN ID and associate it with a ProviderNetwork. This is used for segmenting network traffic within the Underlay setup. ```yaml apiVersion: kubeovn.io/v1 kind: Vlan metadata: name: vlan1 spec: id: 0 provider: net1 ``` -------------------------------- ### Configure Extra Kubernetes Manifests Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Provide an array of additional Kubernetes manifests to deploy. Supports Go templating for custom Helm templates. ```json [] ``` -------------------------------- ### Enable Persistent VM IPs Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Set to true to ensure Virtual Machine IPs are persistent across restarts. ```json true ``` -------------------------------- ### Verify kube-ovn-controller Status Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/kamaji-deployment.md Checks if the kube-ovn-controller deployment in the tenant cluster is in the Ready state. ```bash # kube-ovn-controller must be Ready kubectl --context=tenant -n kube-system rollout status deploy/kube-ovn-controller ``` -------------------------------- ### DPDK Hybrid Support Configuration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Configure DPDK-hybrid support for OVS, including affinity, node selectors, and resource limits. ```json {} ``` ```json {} ``` ```json { "kubernetes.io/os": "linux", "ovn.kubernetes.io/ovs_dp_type": "userspace" } ``` ```json { "limits": { "cpu": "2", "ephemeral-storage": "1Gi", "hugepages-2Mi": "1Gi", "memory": "1000Mi" }, "requests": { "cpu": "200m", "memory": "200Mi" } } ``` ```json "v1.17.0" ``` -------------------------------- ### Scale Down, Delete, and Apply kube-ovn-controller on Migration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Sequence of operations to migrate the kube-ovn-controller, including scaling down, deleting the old deployment, and applying the new one from the v2 chart. ```bash # Scale down kubectl scale deployment kube-ovn-controller -n kube-system --replicas=0 kubectl rollout status deployment kube-ovn-controller -n kube-system # Delete the old Deployment kubectl delete deployment kube-ovn-controller -n kube-system # Apply the new Deployment and Service kubectl apply -f <(helm template kube-ovn ./charts/kube-ovn-v2 -f your-values.yaml \ -s templates/controller/controller-deployment.yaml \ -s templates/controller/controller-service.yaml) ``` -------------------------------- ### Run E2E Tests with Verbose Output Source: https://github.com/kubeovn/kube-ovn/blob/master/test/e2e/non-primary-cni/README.md Execute the Kube-OVN non-primary CNI end-to-end tests with Ginkgo's verbose flag enabled for detailed output. ```bash GINKGO_OUTPUT_OPT="-v" make kube-ovn-non-primary-cni-e2e ``` -------------------------------- ### List Namespace Egress Rules Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/5.CES-namespace策略配置 View existing NamespaceEgressRule resources across all namespaces. This provides an overview of the egress policies currently in effect. ```shell # kubectl get namespaceegressrules -A NAMESPACE NAME ACTION STATUS ns-600 ns600-allow-baidu-bwc accept-decisively Success ns-600 ns600-allow-nginx-api accept-decisively Success ns-700 ns700-allow-icbc-api accept-decisively Success ``` -------------------------------- ### Take a hot backup of the standalone OVN DB Source: https://github.com/kubeovn/kube-ovn/blob/master/docs/single-replica-deployment.md This command executes a backup of the OVN Northbound database (ovnnb_db.sock) from a running ovn-central pod. The backup is saved to a local file. ```bash pod=$(kubectl get pod -n kube-system -l app=ovn-central -o name | head -n1) kubectl exec -n kube-system "$pod" -- \ ovsdb-client backup unix:/var/run/ovn/ovnnb_db.sock > ovnnb_backup.db ``` -------------------------------- ### List Subnets and Pods Source: https://github.com/kubeovn/kube-ovn/wiki/基于Subnet的ACL实现 Displays current subnet configurations and pod IP assignments. Useful for understanding network topology before applying ACLs. ```bash apple@bogon ovn-test % kubectl get subnet NAME PROVIDER VPC PROTOCOL CIDR PRIVATE NAT DEFAULT GATEWAYTYPE V4USED V4AVAILABLE V6USED V6AVAILABLE EXCLUDEIPS join ovn ovn-cluster IPv4 100.64.0.0/16 false false false distributed 2 65531 0 0 ["100.64.0.1"] ovn-default ovn ovn-cluster IPv4 10.16.0.0/16 false true true distributed 6 65527 0 0 ["10.16.0.1"] private ovn ovn-cluster IPv4 2.2.0.0/16 true true false distributed 2 65531 0 0 ["2.2.0.1"] apple@bogon ovn-test % kubectl get pod -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES dynamic-7d8d7874f5-fxhrq 1/1 Running 0 22h 10.16.0.12 kube-ovn-worker apple@bogon ovn-test % apple@bogon ovn-test % kubectl get pod -o wide -n test NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES dynamic-7d8d7874f5-8v4jd 1/1 Running 0 4h42m 2.2.0.3 kube-ovn-control-plane dynamic-7d8d7874f5-fcccl 1/1 Running 0 4h42m 2.2.0.2 kube-ovn-worker apple@bogon ovn-test % ``` -------------------------------- ### Enable CES Debug Logging Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/2.CES安装 Configure the CES controller deployment with command-line arguments to enable debug logging. This is useful for troubleshooting. ```yaml command: - /ces-controller - --bigip-url=$BIGIP_URL - --bigip-insecure=$BIGIP_INSECURE - --bigip-creds-dir=/ces/bigip-creds - --bigip-conf-dir=/ces - --v=3 ``` -------------------------------- ### Delete and Apply kube-ovn-pinger on Migration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Steps to delete the old kube-ovn-pinger DaemonSet and apply the new one from the v2 chart during migration. ```bash # Delete the old DaemonSet kubectl delete daemonset kube-ovn-pinger -n kube-system # Apply the new DaemonSet and Service kubectl apply -f <(helm template kube-ovn ./charts/kube-ovn-v2 -f your-values.yaml \ -s templates/pinger/pinger-daemonset.yaml \ -s templates/pinger/pinger-service.yaml) ``` -------------------------------- ### Detect KIND Bridge Network and Process Configuration Source: https://github.com/kubeovn/kube-ovn/blob/master/test/e2e/non-primary-cni/README.md Go code snippet demonstrating the detection of a KIND bridge network and processing configuration files with the detected network details. This is part of the dynamic KIND bridge detection enhancement. ```go // Detect KIND bridge network network, err := docker.NetworkInspect(kind.NetworkName) kindNetwork := &KindBridgeNetwork{ CIDR: config.Subnet, Gateway: config.Gateway, } // Process configuration with detected network yamlFile, err := processConfigWithKindBridge(originalYamlFile, kindNetwork) ``` -------------------------------- ### Run Logical Network Simple Non-Primary CNI E2E Tests Source: https://github.com/kubeovn/kube-ovn/blob/master/test/e2e/non-primary-cni/README.md Execute end-to-end tests for the Logical Network Simple scenario in non-primary CNI mode. ```bash make kube-ovn-non-primary-cni-lnet-simple-e2e ``` -------------------------------- ### Delete and Apply kube-ovn-monitor on Migration Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Steps to delete the old kube-ovn-monitor Deployment and apply the new one from the v2 chart during migration. ```bash # Delete the old Deployment kubectl delete deployment kube-ovn-monitor -n kube-system # Apply the new Deployment and Service kubectl apply -f <(helm template kube-ovn ./charts/kube-ovn-v2 -f your-values.yaml \ -s templates/monitor/monitor-deployment.yaml \ -s templates/monitor/monitor-service.yaml) ``` -------------------------------- ### Verify CES Controller Pod Source: https://github.com/kubeovn/kube-ovn/wiki/f5-ces/2.CES安装 Confirm that the CES controller pod is running successfully. ```bash [root@ovnmaster kube-ovn-new]# kubectl get pod -A | grep ces kube-system ces-controller-745bf7498d-ztb6b 1/1 Running 0 18d ``` -------------------------------- ### Enable Controller ServiceMonitor Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Set to true to enable the deployment of the ServiceMonitor for the Kube-OVN controller. ```json false ``` -------------------------------- ### OVS/OVN Resource Limits and Requests Source: https://github.com/kubeovn/kube-ovn/blob/master/charts/kube-ovn-v2/README.md Configure CPU, memory, and ephemeral storage limits and requests for ovs-ovn pods. This ensures proper resource allocation and prevents resource starvation. ```json { "limits": { "cpu": "2", "ephemeral-storage": "1Gi", "memory": "1000Mi" }, "requests": { "cpu": "200m", "memory": "200Mi" } } ``` -------------------------------- ### Run Test Server Analysis Source: https://github.com/kubeovn/kube-ovn/blob/master/test/server/README.md Execute the test-server analysis tool to test network connectivity to a specified address and port. This is typically run in one terminal while Kube-OVN is reloaded in another. ```bash # terminal 1 (replace 172.18.0.5/80 with the address/port you want to test) kubectl exec -it test-client -- ./test-server --remote-address=172.18.0.5 --remote-port=80 --output=json --duration-seconds=60 # terminal 2 kubectl ko reload # Try with different address to test different path. ``` -------------------------------- ### Build the FastPath Module Source: https://github.com/kubeovn/kube-ovn/blob/master/fastpath/README.md Compiles the Kube-OVN FastPath kernel module. Navigate to the appropriate directory (e.g., '3.x' or '4.x-6.x') based on your kernel version before running this command. ```bash make all ```