Reader small image

You're reading from  Getting Started with Kubernetes, - Third Edition

Product typeBook
Published inOct 2018
PublisherPackt
ISBN-139781788994729
Edition3rd Edition
Concepts
Right arrow
Authors (2):
Jonathan Baier
Jonathan Baier
author image
Jonathan Baier

Jonathan Baier is an emerging technology leader living in Brooklyn, New York. He has had a passion for technology since an early age. When he was 14 years old, he was so interested in the family computer (an IBM PCjr) that he pored over the several hundred pages of BASIC and DOS manuals. Then, he taught himself to code a very poorly-written version of Tic-Tac-Toe. During his teenage years, he started a computer support business. Throughout his life, he has dabbled in entrepreneurship. He currently works as Senior Vice President of Cloud Engineering and Operations for Moody's corporation in New York.
Read more about Jonathan Baier

Jesse White
Jesse White
author image
Jesse White

Jesse White is a 15-year veteran and technology leader in New York City's very own Silicon Alley, where he is a pillar of the vibrant engineering ecosystem. As founder of DockerNYC and an active participant in the open source community, you can find Jesse at a number of leading industry events, including DockerCon and VelocityConf, giving talks and workshops.
Read more about Jesse White

View More author details
Right arrow

Chapter 15. Kubernetes Infrastructure Management

In this chapter, we'll discuss how to make changes to the infrastructure that powers your Kubernetes infrastructure, whether or not it is a purely public cloud platform or a hybrid installation. We'll discuss methods for handling underlying instance and resource instability, and strategies for running highly available workloads on partially available underlying hardware. We'll cover a few key topics in this chapter in order to build your understanding of how to manage infrastructure in this way:

  • How do we plan to deploy Kubernetes components?
  • How do we secure Kubernetes infrastructure?
  • How do we upgrade the cluster and kubeadm?
  • How do we scale up the cluster?
  • What external resources are available to us?

In this chapter, you'll learn about the following:

  • Cluster upgrades
  • How to manage kubeadm
  • Cluster scaling
  • Cluster maintenance
  • The SIG Cluster Lifecycle group

Technical requirements


You'll need to have your Google Cloud Platform account enabled and logged in, or you can use a local Minikube instance of Kubernetes. You can also use Play with Kubernetes over the web: https://labs.play-with-k8s.com/.

 

Here's the GitHub repository for this chapter: https://github.com/PacktPublishing/Getting-Started-with-Kubernetes-third-edition/tree/master/Code-files/Chapter15.

Planning a cluster


Looking back over the work we've done up till now in this book, there are a lot of options when it comes to building a cluster with Kubernetes. Let's briefly highlight the options you have available to you when you're planning on building your cluster. We have a few key areas to investigate when planning ahead.

Picking what's right

The first and arguably most important step when choosing a cluster is to pick the right hosted platform for your Kubernetes cluster. At a high level, here are the choices you have:

  • Local solutions include the following:
    • Minikube: A single-node Kubernetes cluster
    • Ubuntu on LXD: This uses LXD to deploy a nine-instance cluster of Kubernetes
    • IBM's Cloud Private-CE: This uses VirtualBox to deploy Kubernetes on n+1 instances
    • kubeadm-dind (Docker-in-Docker): This allows for multi-node Kubernetes clusters
  • Hosted solutions include the following:
    • Google Kubernetes Engine
    • Amazon Elastic Container Services
    • Azure Kubernetes Service
    • Stackpoint
    • Openshift online
    • IBM Cloud...

Upgrading the cluster


In order to run your cluster over long periods of time, you'll need to update your cluster as needed. There are several ways to manage cluster upgrades, and the difficulty level of the upgrades is determined by the platform you've chosen previously. As a general rule, hosted Platform as a service (PaaS) options are simpler, while roll your own options rely on you to manage your cluster upgrades.

Upgrading PaaS clusters

Upgrading PaaS clusters is a lot simpler than updating your hand-rolled clusters. Let's check out how the major cloud service providers update their hosted Kubernetes platforms.

With Azure, it's relatively straightforward to manage an upgrade of both the control plane and nodes of your cluster. You can check which upgrades are available for your cluster with the following command:

az aks get-upgrades --name “myAKSCluster” --resource-group myResourceGroup --output table
Name ResourceGroup MasterVersion NodePoolVersion Upgrades

------- --------------- ---...

Scaling the cluster


As with PaaS versus hosted clusters, you have several options for scaling up your production Kubernetes cluster.

On GKE and AKS

When upgrading a GKE cluster, all you need to do is issue a scaling command that modifies the number of instances in your minion group. You can resize the node pools that control your cluster with the following:

gcloud container clusters resize [CLUSTER_NAME] \
 --node-pool [POOL_NAME]
 --size [SIZE]

Keep in mind that new nodes are created with the same configuration as the current machines in your node pool. When additional pods are scheduled, they'll be scheduled on the new nodes. Existing pods will not be relocated or rebalanced to the new nodes.

Scaling up the AKS cluster engine is a similar exercise, where you'll need to specify the --resource-group node count to your required number of nodes:

az aks scale --name myAKSCluster --resource-group gsw-k8s-group --node-count 1

DIY clusters

When you add resources to your hand-rolled Kubernetes cluster...

Additional configuration options


Once you've built up an understanding of how Kubernetes cluster configuration is managed, it's a good idea to explore the additional tools that offer enhanced mechanisms or abstractions to configure the state of your clusters.

ksonnet is one such tool, which allows you to build a structure around your various configurations in order to keep many environments configured. ksonnet uses another powerful tool called Jsonnet in order to maintain the state of the cluster. ksonnet is a different approach to cluster management that's different from the Helm approach we discussed in earlier chapters, in that it doesn't define packages by dependency, but instead takes a composable prototype approach, where you build JSON templates that are rendered by the ksonnet CLI to apply state on the cluster. You start with parts that create prototypes, which becomes a component once it's configured, and those components can then get combined into applications. This helps avoid...

Summary


In this chapter, we discussed how to make changes to the infrastructure that provides compute, storage, and networking capacity to your Kubernetes infrastructure, whether it be a purely public cloud platform or a hybrid installation. In observing the public cloud platforms, we discussed methods for handling underlying instance and resource instability, and strategies for running highly available workloads on partially available underlying hardware.

Additionally, we covered a key topic on how to build infrastructure using tools such as kubeadm, kubectl, and public cloud provider tools that can scale up and down your clusters.

 

 

Questions


  1. Name two available local solutions for Kubernetes
  2. Name three hosted solutions for Kubernetes
  3. What are four of the key areas for securing your cluster?
  4. What is the command to upgrade each of the major CSPs hosted Kubernetes clusters?
  5. Which cloud provider has the most production ready PaaS for Kubernetes?
  6. Which command is use to take a node out of rotation?
  7. Which command is used to add it back in?

Further reading


If you'd like to learn more about Jsonnet, check out this link: https://jsonnet.org/.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Getting Started with Kubernetes, - Third Edition
Published in: Oct 2018Publisher: PacktISBN-13: 9781788994729
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime

Authors (2)

author image
Jonathan Baier

Jonathan Baier is an emerging technology leader living in Brooklyn, New York. He has had a passion for technology since an early age. When he was 14 years old, he was so interested in the family computer (an IBM PCjr) that he pored over the several hundred pages of BASIC and DOS manuals. Then, he taught himself to code a very poorly-written version of Tic-Tac-Toe. During his teenage years, he started a computer support business. Throughout his life, he has dabbled in entrepreneurship. He currently works as Senior Vice President of Cloud Engineering and Operations for Moody's corporation in New York.
Read more about Jonathan Baier

author image
Jesse White

Jesse White is a 15-year veteran and technology leader in New York City's very own Silicon Alley, where he is a pillar of the vibrant engineering ecosystem. As founder of DockerNYC and an active participant in the open source community, you can find Jesse at a number of leading industry events, including DockerCon and VelocityConf, giving talks and workshops.
Read more about Jesse White