drpanwe

kubic-init instructions first draft

Jan 23rd, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

Download openSUSE Tumbleweed latest ISO

Install the following packages needed for building and running

zypper in go git make docker podman cri-o cri-tools etcd kubernetes-kubelet kubernetes-kubeadm cri-o-kubeadm-criconfig

WARNING: In case you see a conflict in dependencies like:

Problem: podman-cni-config-1.0.0-1.1.noarch conflicts with kubernetes-kubelet provided by kubernetes-kubelet-1.13.2-1.1.x86_64

Then do remove the 'podman-cni-config' and install 'kubernetes-kubelet'. Then do:

curl https://pastebin.com/raw/HEFw9fTZ > /etc/cni/net.d/87-podman-bridge.conflist

Now try to see if podman works:

podman run hello-world

Prepare the environment for building

mkdir ~/go
echo 'export GOPATH=$HOME/go' >> ~/.bash_profile
echo "export GOBIN=$GOPATH/bin" >> ~/.bash_profile
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bash_profile
source ~/.bash_profile
mkdir -p $GOPATH/src/github.com
cd $GOPATH/src/github.com
git clone https://github.com/kubic-project/kubic-init
cd kubic-init/
GO111MODULE=off go get -u k8s.io/code-generator/cmd/deepcopy-gen
GO111MODULE=off go get -d -u k8s.io/apimachinery
GO111MODULE=on GO15VENDOREXPERIMENT=1 go generate -x pkg/config//*
make go-version-check

Build it

KUBIC_INIT_BUILD=$(git rev-parse HEAD 2>/dev/null)
KUBIC_INIT_BRANCH=$(git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'unknown')
KUBIC_INIT_BUILD_DATE=$(date +%Y%m%d-%H:%M:%S)
GO_VERSION=$(go version | sed -e 's/^[^0-9.]([0-9.]).*/\1/')
KUBIC_INIT_VERSION='1.0.0'
KUBIC_INIT_LDFLAGS="-X=main.Version=$KUBIC_INIT_VERSION -X=main.Build=$KUBIC_INIT_BUILD -X=main.BuildDate=$KUBIC_INIT_BUILD_DATE -X=main.Branch=$KUBIC_INIT_BRANCH -X=main.GoVersion=$GO_VERSION"
GO111MODULE=on GO15VENDOREXPERIMENT=1 go build -ldflags "$KUBIC_INIT_LDFLAGS" -o cmd/kubic-init/kubic-init cmd/kubic-init/main.go

Build the container

systemctl start docker
docker build -t kubic-project/kubic-init:latest .
docker save kubic-project/kubic-init:latest | gzip > kubic-init-latest.tar.gz
podman load -i kubic-init-latest.tar.gz

Network configuration

echo br_netfilter > /etc/modules-load.d/br_netfilter.conf
modprobe br_netfilter
sysctl -w net.ipv4.ip_forward=1
curl https://raw.githubusercontent.com/kubic-project/kubic-init/master/init/kubelet-sysctl.conf > /etc/sysctl.d/99-kubernetes-cri.conf

Configure kubelet by replacing the kubeadm.conf

curl https://pastebin.com/raw/kN2yLAXZ > /usr/lib/systemd/system/kubelet.service.d/10-kubeadm.conf

Kubic-init configuration

curl https://pastebin.com/raw/YsTUF7Jc > /etc/sysconfig/kubic-init
mkdir /etc/kubic
curl https://pastebin.com/raw/rhnP7EKq > /etc/kubic/kubic-init.yaml

Kubic-init systemd service configuration

curl https://pastebin.com/raw/CgckvaVM > /etc/systemd/system/kubic-init.service

Let us start it

sysctl --system
systemctl daemon-reload
systemctl enable kubelet
systemctl enable --now crio
systemctl enable --now kubic-init

I end up with a failure:
journalctl -u kubic-init

Add Comment
Please, Sign In to add comment