Continental Innovates with Rancher and Kubernetes
Kubernetes is hugely popular and growing, and is primarily used on the cloud — 83 percent of organizations included in a large CNCF survey said they run Kubernetes on at least one public cloud. Amazon is a natural option for Kubernetes clusters, due to its mature and robust infrastructure, and a variety of deployment options with a varying degree of automation.
Read on to understand three key options for running Kubernetes on AWS, how they work and which is best for your organization’s needs.
In this article you will learn:
Kubernetes is an open source container orchestration platform created by Google. You can use Kubernetes for on-premises, cloud or edge deployments. When used in combination with AWS, you use Kubernetes to manage clusters of Amazon Elastic Compute Cloud (EC2) instances that host your containers.
When deploying Kubernetes in AWS, you can configure and manage your deployment by yourself for full flexibility and control. You also have the option of using either AWS-provided services or third-party services to manage your implementation.
Alternatives to self-management include:
Kops lets you create Kubernetes clusters in a few simple steps.
Prerequisites for kops:
To create a cluster on AWS using kops:
NAME
KOPS_STATE_STORE
aws ec2 describe-availability-zones --region us-west-2
us-west-2a
Build your cluster as follows - this is a basic cluster with no high availability:
kops create cluster \ --zones=us-west-2a \ ${NAME}
View your cluster configuration by running the command kops edit cluster ${NAME}. You can leave all settings as default for now.
kops edit cluster ${NAME}
Run the command kops update cluster ${NAME} --yes. This boots instances and downloads Kubernetes components until the cluster reaches a “ready” state.
kops update cluster ${NAME} --yes
Check which nodes are alive by running kubectl get nodes.
kubectl get nodes
Validate that your cluster is working properly by running kops validate cluster.
kops validate cluster
For more details, refer to the kops documentation.
EKS helps manage cluster set up and creation. It offers multi-AZ support and provides automatic replacement of failed or nodes. It also enables on-demand patches and upgrades to clusters. EKS automatically creates three master nodes for each cluster, spread out across three availability zones, as illustrated below. This prevents single points of failure and provides high availability out of the box.
Source: Amazon Web Services
A few prerequisites for creating a cluster on EKS:
To create a Kubernetes cluster using EKS:
To learn more, see the EKS getting started guide.
Using Rancher, you can manage Kubernetes clusters directly on AWS, within the EKS service or across hybrid or multi-cloud systems. Rancher enables you to centrally manage your cluster policies and helps ensure consistent and reliable container access.
Rancher provides the following additional capabilities not fully available in plain Amazon EKS:
Let’s see how to create a cluster on AWS with Rancher. The prerequisites are the same as for EKS (see the previous section).
To create a Kubernetes cluster on AWS with Rancher and EKS:
Start the Rancher server by running this Docker command:
$ sudo docker run -d --restart=unless-stopped -p 80:80 -p 443:443 rancher/rancher
Open a browser and go to the hostname or address where you installed your Docker container. You will see the Rancher server UI.
Select Clusters and click Add cluster. Choose Amazon EKS.
Type a Cluster Name. Under Member Roles, click Add Member to add users that will be able to manage the cluster, and select a Role for each user.
Enter the AWS Region, Access Key and Secret Key you got when creating your VPC.
Click Next: Select Service Role. For this tutorial, select Standard: Rancher-generated service role. This means Rancher will automatically add a service role for the cluster to use. You can also select an existing AWS service role.
Click Next: Select VPC and Subnet. Choose whether there will be a Public IP for Worker Nodes. If you choose No, select a VPC & Subnet to allow instances to access the Internet, so they can communicate with the Kubernetes control plane.
Select a Security Group (defined when you created your VPC).
Click Select Instance Options and select: a. Instance type – you can choose which Amazon instance should be used for your Kubernetes worker nodes. b. Customer AMI override – you can choose a specific Amazon Machine Image to install on your instances. By default, Rancher provides its EKS-optimized AMI. c. Desired ASG size – the number of instances in your cluster. d. User data – custom commands for automated configuration, do not set this when you’re just getting started.
Click Create. Rancher is now provisioning your cluster. You can access your cluster once its state is Active.
For more details, refer to the Rancher AWS quick start guide, or learn more about the Rancher platform.
In this article we showed three ways to automatically spin up a Kubernetes cluster:
Learn more about the Rancher platform and see how easy it is to manage Kubernetes across multiple cloud environments.