Category : Kubernetes | Sub Category : Kubernetes With Java | By Prasad Bonam Last updated: 2023-11-21 13:43:53 Viewed : 221
Deploying an application on Amazon EKS involves several steps, including creating an EKS cluster, configuring kubectl
to interact with the cluster, and deploying your application using Kubernetes manifests or Helm charts. Below is a simplified guide to deploying a basic application on Amazon EKS:
AWS Account:
AWS CLI and kubectl:
kubectl
on your local machine.IAM User with EKS Permissions:
bashaws eks create-cluster --name my-eks-cluster --role-arn arn:aws:iam::123456789012:role/eks-cluster-role --resources-vpc-config subnetIds=subnet-xxxxxxxxxxxxxx,securityGroupIds=sg-xxxxxxxxxxxxxxxxx
kubectl
to interact with the EKS cluster.bashaws eks update-kubeconfig --name my-eks-cluster
bashaws eks create-nodegroup --cluster-name my-eks-cluster --nodegroup-name my-nodegroup --subnets subnet-xxxxxxxxxxxxxx --instance-types t2.micro
bashkubectl get nodes
my-app-deployment.yaml
):yamlapiVersion: apps/v1
kind: Deployment
metadata:
name: my-app-deployment
spec:
replicas: 3
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-app-container
image: nginx:latest
ports:
- containerPort: 80
bashkubectl apply -f my-app-deployment.yaml
my-app-service.yaml
):yamlapiVersion: v1
kind: Service
metadata:
name: my-app-service
spec:
selector:
app: my-app
ports:
- protocol: TCP
port: 80
targetPort: 80
type: LoadBalancer
bashkubectl apply -f my-app-service.yaml
bashaws eks delete-cluster --name my-eks-cluster
This is a basic guide, and the actual deployment may vary based on your application requirements. It is also worth considering Helm charts for managing the deployment and scaling of more complex applications. Additionally, configuring proper security groups, IAM roles, and networking settings are crucial for a production-grade deployment.