User Tools

Site Tools


kubernetes_install_on_fedora

This is an old revision of the document!


Overview

How to install Kubernetes on Fedora 28 using downloadable binary tarballs, based on the installation script you can find here. What this page does is explain what that script accomplishes. Note this does not allow you to build the source, only to run the binaries.

The tarballs

kubernetes.tar.gz

This tarball kicks things off, as the installation script ends with:

echo "Unpacking kubernetes release ${KUBE_VERSION}"
rm -rf "${PWD}/kubernetes"
tar -xzf ${file}

download_kube_binaries
create_cluster

So unload that tarball and get to work.

download_kube_binaries

Overview

This function call does two things:

  • downloads the server tarball, but leaves it unextracted
  • downloads and extracts the client tarball

download_kube_binaries()

This just turns around and calls a script for the download and extraction:

# Use the script from inside the Kubernetes tarball to fetch the client and
# server binaries (if not included in kubernetes.tar.gz).
function download_kube_binaries {
  (
    cd kubernetes
    if [[ -x ./cluster/get-kube-binaries.sh ]]; then
      # Make sure to use the same download URL in get-kube-binaries.sh
      KUBERNETES_RELEASE_URL="${KUBERNETES_RELEASE_URL}" \
        ./cluster/get-kube-binaries.sh
    fi
  )
}

cluster/get-kube-binaries.sh

kubernetes-server-linux-amd64.tar.gz

As you can see, the server tarball is downloaded and simply left under server/ for later:

if "${DOWNLOAD_SERVER_TAR}"; then
  download_tarball "${KUBE_ROOT}/server" "${SERVER_TAR}"
fi

so you can easily do that manually.

kubernetes-client-linux-amd64.tar.gz

Unlike the server tarball, the client tarball is not only downloaded under client/, it is then “extracted”:

if "${DOWNLOAD_CLIENT_TAR}"; then
  download_tarball "${KUBE_ROOT}/client" "${CLIENT_TAR}"
  extract_arch_tarball "${KUBE_ROOT}/client/${CLIENT_TAR}" "${CLIENT_PLATFORM}" "${CLIENT_ARCH}"
fi

The client tarball consists of the single executable kubectl:

$ tar tvf kubernetes-client-linux-amd64.tar.gz 
drwxr-xr-x root/root         0 2018-03-26 13:46 kubernetes/
drwxr-xr-x root/root         0 2018-03-26 13:46 kubernetes/client/
drwxr-xr-x root/root         0 2018-03-26 13:46 kubernetes/client/bin/
-rwxr-xr-x root/root  54277699 2018-03-26 13:46 kubernetes/client/bin/kubectl
$

which will be “installed” and which you'll have to add to your search path shortly.

Here's the extract_arch_tarball() function in that script:

function extract_arch_tarball() {
  local -r tarfile="$1"
  local -r platform="$2"
  local -r arch="$3"

  platforms_dir="${KUBE_ROOT}/platforms/${platform}/${arch}"
  echo "Extracting ${tarfile} into ${platforms_dir}"
  mkdir -p "${platforms_dir}"
  # Tarball looks like kubernetes/{client,server}/bin/BINARY"
  tar -xzf "${tarfile}" --strip-components 3 -C "${platforms_dir}"
  # Create convenience symlink
  ln -sf "${platforms_dir}" "$(dirname ${tarfile})/bin"
  echo "Add '$(dirname ${tarfile})/bin' to your PATH to use newly-installed binaries."
}

In short, from the ${KUBE_ROOT} directory (and in the context of a 64-bit Fedora system), extract that single kubectl executable::

$ mkdir -p platforms/linux/amd64
$ tar xvf ../kubernetes-client-linux-amd64.tar.gz \
> --strip-components 3 \
> -C platforms/linux/amd64
$
$ tree platforms
platforms
└── linux
    └── amd64
        └── kubectl
        $

Finally, make sure you can find kubectl on your search path somehow:

$ PATH=$PATH:/home/rpjday/kubernetes/dl/kubernetes/platforms/linux/amd64

create_cluster

kubernetes_install_on_fedora.1523268246.txt.gz · Last modified: 2018/04/09 10:04 by rpjday