AWS Open Source Blog

Announcing EKS Support in mu

中文版

Getting started with application development on Amazon EKS can require you to create the Kubernetes cluster, code repos, and configure deployment pipelines to continuously push code changes to the cluster. In this post, Casey Lee of Stelligent shows how mu, an open source tool, can be used to simplify the declaration and administration of all AWS resources so that you can focus on your application.

Arun


In an earlier post, Pipelines For Container Applications Made Easy with mu, we saw how quickly you can build CI/CD pipelines for container workloads with the mu open source tool. The pipelines leveraged services such as AWS CodeBuild and AWS CodePipeline for orchestrating the build and deployment of their container applications. Additionally, mu used Amazon Elastic Container Service (Amazon ECS) for running the workloads.

In a recent release, mu added support for Amazon Elastic Container Service for Kubernetes (Amazon EKS). In this post, we’ll demonstrate how to use mu to setup a CI/CD pipeline to deploy an application to EKS. First, let’s review the architecturally-significant components of the environment that mu creates:

  • EKS Cluster – the control plane for the Kubernetes cluster that is offered as a managed service by EKS.
  • EKS Worker Nodes – an auto scaling group of EC2 instances that represent the worker nodes in the cluster.
  • RBAC – the ConfigMap used to associate IAM Users and Roles to Kubernetes users, as well as the role binding from those users to Kubernetes roles.
  • Ingress Controller – the NGINX ingress controller to support external access to services within the cluster.

mu on AWS architecture

Let’s Try It Out!

For demonstration purposes, we will use the same sample application (github.com/cplee/hello-nginx) from the prior post. Fork the repo and clone it locally. The mu.yml requires a few changes to target EKS:

###
# Define 2 environments, both with `eks` provider
###
environments:
- name: acceptance
  provider: eks
- name: production
  provider: eks

###
# Configure an ingress with a route for paths /*
# to port 80 in the container
###
service:
 port: 80
 pathPatterns:
 - /*
###
# Configure IAM user `casey.lee` with admin access
# in the EKS cluster
###
rbac:
- role: admin
  users:
  - casey.lee

Commit and push the changes back to GitHub before we build a pipeline with mu. If this is your first time using mu, you can run the following command to download the mu binary file and have it added to your path:

curl -s https://getmu.io/install.sh | sh

The pipeline is created by running the following command. It will prompt you for a GitHub personal access token that CodePipeline requires to configure the commit hook.

mu pipeline up

  

Once the pipeline completes, your application will now be running on a newly-created EKS cluster. Since EKS offers an upstream Kubernetes experience, you can use tools such as kubectl to interact with the cluster. By default, only the IAM role used by CloudFormation to provision the EKS cluster will have access to manage the resources in the cluster. However, since I specified my IAM User in the mu.yml above, I can use my IAM credentials to communicate with the cluster. First, I’ll need to update my kubeconfig with connection information for the new cluster:

aws-cli

Next, use the new context that was created:

kubectl

You can now use kubectl to view basic information about the cluster:

kubectl

Additionally, you can see the detail of the ingress controller and the sample application that was deployed:

kubectl

Details about the EKS cluster are viewable via mu. Additionally, you can determine the URL of the ELB to then test the application:

kubectl

browser

Why Open Source?

At Stelligent, we help our customers build continuous delivery pipelines on AWS. One of our core values is sharing. We want to be open with our customers and give them access to the tools we use on our engagements with them. By open sourcing mu, we are able to empower our customers to have a sense of ownership of the tool we are using in their accounts.

Another goal with creating and open sourcing mu was to share our learnings and opinions with the community on how best to implement these pipelines. Our hope is for the community to use the tool and evolve it based on their use cases, and provide feedback on even better ways to approach the problems we are trying to solve.

Contribute to mu!

If you have an interest in continuous delivery pipelines for container workloads, we need your help! Here’s how:

  • Try it out – Visit the quickstart on the mu wiki to download and install the tool. You can also follow a brief tutorial to create your first service.
  • Share your feedback – Ask questions and let us know what you think by chatting with us on in our Gitter room. Also, don’t hesitate to create a new issue with any feature requests.
  • Contribute – Check out the opportunities to help with upcoming EKS features on GitHub issues. Pull requests always welcome! Visit the contributing guide for more details.

Casey LeeCasey Lee

Casey Lee is the Chief Architect at Stelligent – a Premier Consulting Partner with the DevOps Competency that has been implementing Continuous Delivery solutions on AWS since 2009. He is an AWS Certified DevOps Engineer – Professional and Solution Architect – Professional. He has spent the past 20 years architecting, implementing, and supporting software systems for organizations ranging from startups to Fortune 500 enterprises.

The content and opinions in this post are those of the third-party author and AWS is not responsible for the content or accuracy of this post.

Arun Gupta

Arun Gupta

Arun Gupta is a Principal Open Source Technologist at Amazon Web Services. He focuses on everything containers and open source at AWS. He is responsible for CNCF strategy within AWS, and participates at CNCF Board and technical meetings actively. He has built and led developer communities for 12+ years at Sun, Oracle, Red Hat and Couchbase. He has extensive speaking experience in more than 40 countries on myriad topics and is a JavaOne Rock Star for four years in a row. Gupta also founded the Devoxx4Kids chapter in the US and continues to promote technology education among children. A prolific blogger, author of several books, an avid runner, a globe trotter, a Docker Captain, a Java Champion, a JUG leader, NetBeans Dream Team member, he is easily accessible at @arungupta.