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

On the other hand, the client tarball is downloaded under client/ and 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

What happens:

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."
}

The client tarball consists of nothing but kubernetes/client/bin/kubectl.

create_cluster

kubernetes_install_on_fedora.1523267160.txt.gz · Last modified: 2018/04/09 09:46 by rpjday