You are browsing a read-only backup copy of Wikitech. The live site can be found at wikitech.wikimedia.org

Kubernetes/Packages

From Wikitech-static
< Kubernetes
Revision as of 11:29, 7 October 2020 by imported>Alexandros Kosiaris (First draft)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Intro

For a variety of reasons, we deploy our kubernetes components in WMF production (Tools/Toolforge is a completely different environment) using Debian packages. Those are:

  • kubernetes-client
  • kubernetes-master
  • kubernetes-node

kubernetes-client one has kubectl in it, kubernetes-master has kube-apiserver, kube-scheduler, kube-controller-manager and kuberetes-node has kubelet and kube-proxy components.

Below there is a guide about how to get those built

Prereqs

Use of the main build hosts in production isn't possible currently. This is due to the fact that kubernetes uses a docker based build environment and our production build hosts don't have internet access by design.

So, a WMCS VM is used instead. At the time of this writing, this is builder01.packaging.eqiad.wmflabs

Building

Fetch the new version

 curl -O https://dl.k8s.io/v1.18.9/kubernetes-src.tar.gz
 mv kubernetes-src.tar.gz kubernetes_1.18.9.orig.tar.gz
 git clone "https://gerrit.wikimedia.org/r/operations/debs/kubernetes"
 cd kubernetes

Cleanup previous artifacts

 make clean

Update the repo to the new version

 git rm -r . ; git reset HEAD debian/ ; git checkout debian
 tar xfz ../kubernetes_1.18.9.orig.tar.gz
 git add .

Bump changelog and refresh patches

 dch
 QUILT_PATCHES=debian/patches quilt push

if the previous command fails, you got to apply manually and then run QUILT_PATCHES=debian/patches quilt refresh. After that continue with the next step. You probably will anyway have to meddle a bit with it to update the version string. Sample patch below

--- kubernetes.orig/build/lib/release.sh
+++ kubernetes/build/lib/release.sh
@@ -360,7 +360,7 @@ function kube::release::create_docker_im
     local docker_tag="${KUBE_GIT_VERSION/+/_}"
     if [[ -z "${docker_tag}" ]]; then
       kube::log::error "git version information missing; cannot create Docker tag"
-      return 1
+      docker_tag='v1.18.9'
     fi
 
     # provide `--pull` argument to `docker build` if `KUBE_BUILD_PULL_LATEST_IMAGES`


 git add debian
 git commit 

Build

 dpkg-buildpackage -uc -us -sa

If the above errors out, fix the issues, and try building again. Rinse and repeat until it succeeds.