Skip to content

Latest commit

 

History

History
106 lines (72 loc) · 6.97 KB

intro-k8s-04.md

File metadata and controls

106 lines (72 loc) · 6.97 KB

Installing Kubernetes

Introduction

In this chapter, we will first discuss about the different configurations in which Kubernetes can be installed. We will then discuss about the infrastructure requirements to install Kubernetes, and we will also look at some of the tools which can help us with the installation.

Learning Objectives

By the end of this chapter, you should be able to:

  • Discuss about the different Kubernetes configuration options.
  • Discuss infrastructure considerations before installing Kubernetes.
  • Discuss infrastructure choices for a Kubernetes deployment.
  • Review Kubernetes installation tools and resources.

Kubernetes Configuration

Kubernetes can be installed using different configurations. The four major installation types are briefly presented below:

  • All-in-One Single-Node Installation
    With all-in-one, all the master and worker components are installed on a single node. This is very useful for learning, development, and testing. This type should not be used in production. Minikube is one such example, and we are going to explore it in future chapters.
  • Single-Node etcd, Single-Master, and Multi-Worker Installation
    In this setup, we have a single master node, which also runs a single-node etcd instance. Multiple worker nodes are connected to the master node.
  • Single-Node etcd, Multi-Master, and Multi-Worker Installation
    In this setup, we have multiple master nodes, which work in an HA mode, but we have a single-node etcd instance. Multiple worker nodes are connected to the master nodes.
  • Multi-Node etcd, Multi-Master, and Multi-Worker Installation
    In this mode, etcd is configured in a clustered mode, outside the Kubernetes cluster, and the nodes connect to it. The master nodes are all configured in an HA mode, connecting to multiple worker nodes. This is the most advanced and recommended production setup.

Infrastructure for Kubernetes Installation

Once we decide on the installation type, we also need to make some infrastructure-related decisions, such as:

  • Should we set up Kubernetes on bare metal, public cloud, or private cloud?
  • Which underlying system should we use? Should we choose RHEL, CoreOS, CentOS, or something else?
  • Which networking solution should we use?
  • And so on.

The Kubernetes documentation has details in regards to choosing the right solution. Next, we will take a closer look at these solutions.

Localhost Installation

There are a few localhost installation options available to deploy single- or multi-node Kubernetes clusters on our workstation/laptop:

Minikube is the preferred and recommended way to create an all-in-one Kubernetes setup. We will be using it extensively in this course.

On-Premise Installation

Kubernetes can be installed on-premise on VMs and bare metal.

  • On-Premise VMs
    Kubernetes can be installed on VMs created via Vagrant, VMware vSphere, KVM, etc. There are different tools available to automate the installation, like Ansible or kubeadm.
  • On-Premise Bare Metal
    Kubernetes can be installed on on-premise bare metal, on top of different operating systems, like RHEL, CoreOS, CentOS, Fedora, Ubuntu, etc. Most of the tools used to install VMs can be used with bare metal as well.

Cloud Installation

Kubernetes can be installed and managed on almost any cloud environment:

Kubernetes Installation Tools/Resources

While discussing installation configuration and the underlying infrastructure, let's take a look at some useful tools/resources available:

  • kubeadm
    kubeadm is a first-class citizen on the Kubernetes ecosystem. It is a secure and recommended way to bootstrap the Kubernetes cluster. It has a set of building blocks to setup the cluster, but it is easily extendable to add more functionality. Please note that kubeadm does not support the provisioning of machines.
  • KubeSpray
    With KubeSpray (formerly known as Kargo), we can install Highly Available Kubernetes clusters on AWS, GCE, Azure, OpenStack, or bare metal. KubeSpray is based on Ansible, and is available on most Linux distributions. It is a Kubernetes Incubator project.
  • Kops
    With Kops, we can create, destroy, upgrade, and maintain production-grade, highly-available Kubernetes clusters from the command line. It can provision the machines as well. Currently, AWS is officially supported. Support for GCE and VMware vSphere are in alpha stage, and other platforms are planned for the future.

If the existing solutions and tools do not fit your requirements, then you can always install Kubernetes from scratch.

It is worth checking out the Kubernetes The Hard Way GitHub project by Kelsey Hightower, which shares the manual steps involved in bootstrapping a Kubernetes cluster.

Learning Objectives (Review)

You should now be able to:

  • Discuss about the different Kubernetes configuration options.
  • Discuss infrastructure considerations before installing Kubernetes.
  • Discuss infrastructure choices for a Kubernetes deployment.
  • Review Kubernetes installation tools and resources.