containerized-data-importer/cluster-up/cluster/K8S.md
akalenyu 494ca402d3
Update kubevirtci (#2454)
We're running quite far behind, let's bump so we can debug early before we really need something

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>

Signed-off-by: Alex Kalenyuk <akalenyu@redhat.com>
2022-11-01 15:00:56 +00:00

2.6 KiB

Kubernetes 1.x in ephemeral containers

Provides a pre-deployed Kubernetes with version 1.x purely in docker containers with qemu. The provided VMs are completely ephemeral and are recreated on every cluster restart.

Docker registry

There's a docker registry available which is exposed at localhost:5000.

Choosing a cluster version

The env variable KUBEVIRT_PROVIDER tells kubevirtci what cluster version to spin up.

export KUBEVIRT_PROVIDER=k8s-1.22   # choose kubevirtci provider version by subdirectory name

Bringing the cluster up

export KUBEVIRT_NUM_NODES=2         # control-plane + one node
make cluster-up

The cluster can be accessed as usual:

$ cluster/kubectl.sh get nodes
NAME      STATUS     ROLES          AGE       VERSION
node01    NotReady   control-plane  31s       v1.22.1
node02    NotReady   <none>         5s        v1.22.1

Note: for further configuration environment variables please see cluster-up/hack/common.sh

Bringing the cluster up with cluster-network-addons-operator provisioned

export KUBEVIRT_WITH_CNAO=true
make cluster-up

To get more info about CNAO you can check the github project documentation here https://github.com/kubevirt/cluster-network-addons-operator

Bringing the cluster up with cgroup v2

export KUBEVIRT_CGROUPV2=true
make cluster-up

Use slim provider (without pre-pulled images of the optional components such as CDI, CNAO etc)

export KUBEVIRT_SLIM=true
make cluster-up

Enabling IPv6 connectivity

In order to be able to reach from the cluster to the host's IPv6 network, IPv6 has to be enabled on your Docker. Add following to your /etc/docker/daemon.json and restart docker service:

{
    "ipv6": true,
    "fixed-cidr-v6": "2001:db8:1::/64"
}
systemctl restart docker

With an IPv6-connected host, you may want the pods to be able to reach the rest of the IPv6 world, too. In order to allow that, enable IPv6 NAT on your host:

ip6tables -t nat -A POSTROUTING -s 2001:db8:1::/64 -j MASQUERADE

Bringing the cluster down

make cluster-down

This destroys the whole cluster. Recreating the cluster is fast, since k8s is already pre-deployed. The only state which is kept is the state of the local docker registry.

Destroying the docker registry state

The docker registry survives a make cluster-down. It's state is stored in a docker volume called kubevirt_registry. If the volume gets too big or the volume contains corrupt data, it can be deleted with

docker volume rm kubevirt_registry