In this article we are going to cover How to Deploy nodejs app to EKS using GitHub Actions | Build and Deploy to Kubernetes using GitHub Actions | Automatic deploy to Kubernetes with GitHub Action.
Table of Contents
Prerequisites:
- AWS Account with Admin Previleges
- GitHub Account
Step #1:Create Amazon EKS cluster using eksctl
Please follow below article to Create Amazon EKS cluster using eksctl.
How to Create Amazon EKS cluster using eksctl
Step #2:Create Amazon Elastic Container Registry (ECR)
Go to your AWS account and create new ECR as shown below

Deploy nodejs app to EKS using GitHub Actions
Step #3:GitHub Actions workflow Deploy to Kubernetes
Now we need to create new GiHub Repository and push the code.
So this is my GiHub Repo of Deploy nodejs app to EKS using GitHub Actions so you can clone our repo
Here is your workflow to Deploy nodejs app to EKS using GitHub Actions.
name: Node js app deploy to EKS
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install kubectl
uses: azure/[email protected]
with:
version: 'v1.27.0' # default is latest stable
id: install
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ap-south-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push docker image to Amazon ECR
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
REPOSITORY: devopshint
IMAGE_TAG: 1.1
run: |
docker build -t $REGISTRY/$REPOSITORY:$IMAGE_TAG .
docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG
- name: Update kube config
run: aws eks update-kubeconfig --name devops-cluster
- name: Deploy to EKS
run: |
kubectl apply -f deployment.yaml
kubectl apply -f service.yaml
Step #4:Create Secret in GitHub Repository
So here we need to create two secrets here
- AWS ACCESS KEY ID
- AWS SECRET ACCESS KEY ID

Step #5:Check nodes, service and pods
To check the details about your node run the below command
kubectl get nodes
kubectl get pods

kubectl get svc

Step #6:Access Nodejs app on browser using LoadBalancer
copy the External IP of nodejs and hit on your browser

Conclusion:
In this article we have covered How to Deploy nodejs app to EKS using GitHub Actions | Build and Deploy to Kubernetes using GitHub Actions | Automatic deploy to Kubernetes with GitHub Actions.
How eks cluster is connected with github actions?
AWS Access key, secret key and kubeconfig.
I am doing same thing but getting below error. I tried to access other aws commands which worked expected even I checked kubeconfig which is getting updated after command – aws eks update-kubeconfig –name poc-eks-5jgBdToE –region us-east-2
E1009 13:59:54.122446 1908 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E1009 13:59:54.861131 1908 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E1009 13:59:55.601518 1908 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E1009 13:59:56.351713 1908 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
E1009 13:59:57.107027 1908 memcache.go:265] couldn’t get current server API group list: the server has asked for the client to provide credentials
error: You must be logged in to the server (the server has asked for the client to provide credentials)