- Notifications
You must be signed in to change notification settings - Fork92
GitHub Actions, Flux, and Amazon EKS ✨
License
github-developer/example-actions-flux-eks
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
An example workflow that usesGitHub Actions to builda static website into a Docker container, push that image to Amazon Elastic Container Registry, and usesFlux to automatically update an existing Amazon Elastic Kubernetes Service cluster with that image.
See thistechnical blog post which uses this code for full step-by-step instructions.
- Create an EKS cluster, e.g. using
eksctl create cluster
- Set up Flux on the cluster, e.g. usingthis guide. Note that you must set
--git-path
to point to where your manifests are. For example:
export GHOWNER=<github user or organization account where your fork lives>export GHREPO=example-actions-flux-ekskubectl create ns fluxfluxctl install \ --git-user=${GHUSER} \ --git-email=${GHUSER}@users.noreply.github.com \ --git-url=git@github.com:${GHOWNER}/${GHREPO} \ --git-path=manifests \ --namespace=flux| kubectl apply -f -
- Give Flux read/write access to the GitHub repositoryusing a deploy key
- Create a repository called
example-eks
inAmazon Elastic Container Registry, in the same AWS region as the EKS cluster - Update the image in
deployment.yml
to use yourREGISTRY
,IMAGE
, andTAG
.TAG
will be replaced by Flux as new images are available in the registry.
The following secrets are required to be set on the repository:
AWS_ACCOUNT_ID
: The AWS account ID that owns the EKS clusterAWS_ACCESS_KEY_ID
: An AWS access key ID for an account having theEKS IAM roleAWS_SECRET_ACCESS_KEY
: An AWS secret sccess key for an account having theEKS IAM role
Theexample workflow will trigger on every push to this repo.
Forpull requests, the workflow will:
- Build and tagthe Docker image
- The image will be tagged with the feature branch's HEAD commit SHA
Forpushes to the default branch (master
), in addition to the above, the workflow will:
- Push the image to Amazon Elastic Container Registry
Flux watches ECR for changes to the image listed in ourdeployment configuration. When it detects a change, it updates the EKS cluster with the new image, no manualkubectl apply
needed!
We welcome contributions! Seehow to contribute.
About
GitHub Actions, Flux, and Amazon EKS ✨
Resources
License
Code of conduct
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Uh oh!
There was an error while loading.Please reload this page.
Contributors3
Uh oh!
There was an error while loading.Please reload this page.