Getting started

This guide takes developers from a clean Ubuntu machine to a running CODECO application, which is the technology KuDECO builds on. It covers a single cluster; see Federated clusters for multi-cluster operation.

Choose your mode

ModeWhat it isCode
Single clusterKuDECO operates within one clusterkudeco-basic-operation
Federated clustersA Hub coordinates Managed Clusters using Open Cluster Management (OCM)kudeco-federated-operation

What you need

  • Kubernetes, in the flavour of your choice (for example kind, MicroK8s, kubeadm or K3s). Installation is tested on a 3-node kind cluster on Ubuntu 20.04.
  • For that kind setup: 4 CPU cores and 8 GB of RAM
  • sudo rights and a Docker Hub account
  • Familiarity with kubectl

1. Install the prerequisites

Skip what you already have. The commands are for x86_64 Ubuntu.

sudo apt update
sudo apt install -y git nano curl wget make sudo rsync jq

# yq (4.18.1 or later)
sudo wget https://github.com/mikefarah/yq/releases/download/v4.34.2/yq_linux_amd64 -O /usr/bin/yq
sudo chmod +x /usr/bin/yq

# Docker
curl -fsSL https://get.docker.com | sh
sudo groupadd docker
sudo usermod -aG docker $USER
newgrp docker

newgrp opens a new shell, so run the rest after it.

docker run hello-world

# kind (only for a kind cluster)
curl -Lo ./kind https://kind.sigs.k8s.io/dl/v0.23.0/kind-linux-amd64
chmod +x ./kind
sudo mv ./kind /usr/local/bin/kind

# Helm
curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
chmod 700 get_helm.sh
./get_helm.sh

# Go (replaces any existing /usr/local/go)
wget https://go.dev/dl/go1.21.10.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.21.10.linux-amd64.tar.gz
echo 'export PATH="$PATH:/usr/local/go/bin"' >> ~/.bashrc
source ~/.bashrc

# kubectl
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
kubectl version --client

# cmctl
curl -fsSL -o cmctl https://github.com/cert-manager/cmctl/releases/latest/download/cmctl_$(go env GOOS)_$(go env GOARCH)
chmod +x cmctl
sudo mv cmctl /usr/local/bin

Flannel needs the br_netfilter kernel module:

echo br_netfilter | sudo tee /etc/modules-load.d/containerd.conf
sudo modprobe br_netfilter

2. Create the cluster (kind only)

Warning: the second command deletes any existing kind cluster named kind.

git clone https://gitlab.eclipse.org/eclipse-research-labs/codeco-project/acm.git
kind delete cluster
kind create cluster --config ./acm/config/cluster/kind-config.yaml

On the first installation on a machine, also add the CNI plugins and system settings:

mkdir -p plugins/bin
wget https://github.com/containernetworking/plugins/releases/download/v1.6.0/cni-plugins-linux-amd64-v1.6.0.tgz
tar -xf cni-plugins-linux-amd64-v1.6.0.tgz -C ./plugins/bin

for node in kind-control-plane kind-worker kind-worker2; do
  docker cp ./plugins/bin/. $node:/opt/cni/bin
  docker exec $node modprobe br_netfilter
  docker exec $node sysctl -p /etc/sysctl.conf
  docker exec $node sysctl -w fs.inotify.max_user_watches=524288 fs.inotify.max_user_instances=512
done

sudo sysctl -w fs.inotify.max_user_watches=524288 fs.inotify.max_user_instances=512

3. Install CODECO

Deploying ACM (Automated Configuration Management) also deploys the other components.

read -p "Docker Hub user: " DOCKERHUB_USER
read -s -p "Docker Hub password or token: " DOCKERHUB_PASS; echo
echo "$DOCKERHUB_PASS" | docker login -u "$DOCKERHUB_USER" --password-stdin

cd acm
make deploy      # uses the pre-built image
cd ..

To build your own operator image instead, run these inside acm:

make docker-buildx IMG=$DOCKERHUB_USER/codecoapp-operator:2.0.0 PLATFORMS="linux/amd64,linux/arm64,linux/ppc64le,linux/s390x"
make deploy IMG=$DOCKERHUB_USER/codecoapp-operator:2.0.0

4. Deploy a sample application

This deploys a frontend and a backend described with the CODECO Application Model (CAM):

kubectl apply -f ./acm/config/samples/codeco_v1alpha1_codecoapp_ver3.yaml

Replace the path to deploy your own CAM file. Network requirements are set per service channel:

serviceChannels:
  - advancedChannelSettings:
      Bandwidth: "5M"
      maxDelay: "1s"

There are two service classes:

  • Best-Effort: uses the default Kubernetes networking overlay
  • Assured: requires the L2SM secure connectivity overlay

5. Verify the installation

Wait for the application pods (up to 20 minutes):

kubectl wait --for=condition=Ready pod --all -n he-codeco-acm --timeout=20m
kubectl get pods -A

Check the network metrics. The underlay-topology and overlay-topology sections should be filled in:

kubectl get netma-topology netma-sample -o yaml -n he-codeco-netma

After PDLC has been running for 2–3 minutes, the output of this command should contain nodeRecommendations:

kubectl get applications.qos-scheduler.siemens.com -n he-codeco-acm acm-swm-app -o yaml

Expose your application’s metrics

To have Prometheus collect them, add these annotations to the pod template:

annotations:
  prometheus.io/scrape: "true"
  prometheus.io/port: "<port>"
  prometheus.io/path: "<metric path>"

Troubleshooting

ProblemWhat to do
Multus pods crash on kind (“too many open files”)sudo sysctl fs.inotify.max_user_watches=524288 fs.inotify.max_user_instances=512
Secure connectivity packets dropped; iptables -L FORWARD shows policy DROPOn each node: sudo iptables -P FORWARD ACCEPT, then restart the affected pods. This relaxes the node firewall, so check your security policy first.
No new recommendation after removing an application podkubectl delete pod <pdlc-rl-pod> -n he-codeco-pdlc
Running on K3sInstall Multus first
Kepler errors on ARM nodesEnable BTF in the kernel

Uninstall

For kind, delete the cluster:

kind delete cluster

For other clusters, run ./remove_codeco.sh. To remove PDLC completely, also delete the /data directory on the node where it ran.

Federated clusters

  1. Set up the Hub cluster and register the Managed Clusters using OCM.
  2. Deploy the CODECO Operator (ACM) on the Hub.
  3. Submit your CAM file to ACM on the Hub. Watch the demo.

Commands and configuration are in kudeco-federated-operation.