Deploy Kubernetes resources and packages using Amazon EKS and a Helm chart repository in Amazon S3
Created by Sagar Panigrahi (AWS)
Environment: PoC or pilot | Technologies: Containers & microservices; DevOps | AWS services: Amazon EKS |
Summary
This pattern helps you to manage Kubernetes applications efficiently, regardless of their complexity. The pattern integrates Helm into your existing continuous integration and continuous delivery (CI/CD) pipelines to deploy applications into a Kubernetes cluster. Helm is a Kubernetes package manager that helps you manage Kubernetes applications. Helm charts help to define, install, and upgrade complex Kubernetes applications. Charts can be versioned and stored in Helm repositories, which improves mean time to restore (MTTR) during outages.
This pattern uses Amazon Elastic Kubernetes Service (Amazon EKS) for the Kubernetes cluster. It uses Amazon Simple Storage Service (Amazon S3) as a Helm chart repository, so that the charts can be centrally managed and accessed by developers across the organization.
Prerequisites and limitations
Prerequisites
An active Amazon Web Services (AWS) account with a virtual private cloud (VPC)
An Amazon EKS cluster
Worker nodes set up within the Amazon EKS cluster and ready to take workloads
Kubectl for configuring the Amazon EKS kubeconfig file for the target cluster in the client machine
AWS Identity and Access Management (IAM) access to create the S3 bucket
IAM (programmatic or role) access to Amazon S3 from the client machine
Source code management and a CI/CD pipeline
Limitations
There is no support at this time for upgrading, deleting, or managing custom resource definitions (CRDs).
If you are using a resource that refers to a CRD, the CRD must be installed separately (outside of the chart).
Product versions
Helm v3.6.3
Architecture
Target technology stack
Amazon EKS
Amazon VPC
Amazon S3
Source code management
Helm
Kubectl
Target architecture
Automation and scale
AWS CloudFormation can be used to automate the infrastructure creation. For more information, see Creating Amazon EKS resources with AWS CloudFormation in the Amazon EKS documentation.
Helm is to be incorporated into your existing CI/CD automation tool to automate the packaging and versioning of Helm charts (out of scope for this pattern).
GitVersion or Jenkins build numbers can be used to automate the versioning of charts.
Tools
Tools
Amazon EKS – Amazon Elastic Kubernetes Service (Amazon EKS) is a managed service for running Kubernetes on AWS without needing to stand up or maintain your own Kubernetes control plane. Kubernetes is an open-source system for automating the deployment, scaling, and management of containerized applications.
Helm
– Helm is a package manager for Kubernetes that helps you install and manage applications on your Kubernetes cluster. Amazon S3 – Amazon Simple Storage Service (Amazon S3) is storage for the internet. You can use Amazon S3 to store and retrieve any amount of data at any time, from anywhere on the web.
Kubectl
– Kubectl is a command line utility for running commands against Kubernetes clusters.
Code
The example code is attached.
Epics
Task | Description | Skills required |
---|---|---|
Install the Helm client. | To download and install the Helm client on your local system, use the following command.
| DevOps engineer |
Validate the Helm installation. | To validate that Helm is able to communicate with the Kubernetes API server within the Amazon EKS cluster, run | DevOps engineer |
Task | Description | Skills required |
---|---|---|
Create a Helm chart for NGINX. | To create a helm chart named | DevOps engineer |
Review the structure of the chart. | To review the structure of the chart, run the tree command | DevOps engineer |
Deactivate service account creation in the chart. | In | DevOps engineer |
Validate (lint) the modified chart for syntactical errors. | To validate the chart for any syntactical error before installing it in the target cluster, run | DevOps engineer |
Install the chart to deploy Kubernetes resources. | To run the Helm chart installation, use the following command.
The optional | DevOps engineer |
Review the resources in the Amazon EKS cluster. | To review the resources that were created as part of the Helm chart in the
| DevOps engineer |
Task | Description | Skills required |
---|---|---|
Modify and upgrade the release. | To modify the chart, in
| DevOps engineer |
Review the history of the Helm release. | To list all the revisions for a specific release that have been installed using Helm, run the following command.
| DevOps engineer |
Review the details for a specific revision. | Before switching or rolling back to a working version, and for an additional layer of validation before installing a revision, view which values were passed to each of the revisions by using the following command.
| DevOps engineer |
Roll back to a previous version. | To roll back to a previous revision, use the following command.
This example is rolling back to revision number 1. | DevOps engineer |
Task | Description | Skills required |
---|---|---|
Create an S3 bucket for Helm charts. | Create a unique S3 bucket. In the bucket, create a folder called | Cloud administrator |
Install the Helm plugin for Amazon S3. | To install the helm-s3 plugin on your client machine, use the following command.
Note: Helm V3 support is available with plugin version 0.9.0 and above. | DevOps engineer |
Initialize the Amazon S3 Helm repository. | To initialize the target folder as a Helm repository, use the following command.
The command creates an | DevOps engineer |
Add the Amazon S3 repository to Helm. | To add the repository in the client machine, use the following command.
This command adds an alias to the target repository in the Helm client machine. | DevOps engineer |
Review the repository list. | To view the list of repositories in the Helm client machine, run | DevOps engineer |
Task | Description | Skills required |
---|---|---|
Package the chart. | To package the | DevOps engineer |
Store the package in the Amazon S3 Helm repository. | To upload the package to the Helm repository in Amazon S3, run the following command, using the correct name of the
| DevOps engineer |
Search for the Helm chart. | To confirm that the chart appears both locally and in the Helm repository in Amazon S3, run the following command.
| DevOps engineer |
Task | Description | Skills required |
---|---|---|
Modify and package the chart. | In The versioning is ideally updated through automation using tools such as GitVersion or Jenkins build numbers in a CI/CD pipeline. Automating the version number is out of scope for this pattern. | DevOps engineer |
Push the new version to the Helm repository in Amazon S3. | To push the new package with version of 0.1.1 to the
| DevOps engineer |
Task | Description | Skills required |
---|---|---|
Search for all versions of the my-nginx chart. | To view all the available versions of a chart, run the following command with the
Without the flag, Helm by default displays the latest uploaded version of a chart. | DevOps engineer |
Install a chart from the Amazon S3 Helm repository. | The search results from the previous task show the multiple versions of the
| DevOps engineer |
Related resources
Attachments
To access additional content that is associated with this document, unzip the following file: attachment.zip