← All posts

Implementing Amazon EKS: From Zero to Deploy · Part 6 of 6

Implementing Amazon Elastic Kubernetes Service: From Zero to Deploy (Part 6/6)

Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service on AWS. With it, customers such as Intel…

2 min read361 wordsSections: 1Code blocks: 8Apr 19, 2022

Keywords

Share
Comment
Implementing Amazon Elastic Kubernetes Service: From Zero to Deploy (Part 6/6)

Amazon Elastic Kubernetes Service (Amazon EKS) is a fully managed Kubernetes service on AWS. With it, customers such as Intel, Snap, Intuit, GoDaddy and many other companies run their most sensitive and mission-critical applications thanks to its security, reliability and scalability. In this series of posts we will see how to implement Amazon EKS from scratch all the way to deploying an application. The topics we will cover:

  • Part 1 — Configuring a cluster in EKS
  • Part 2 — Configuring node-groups in EKS
  • Part 3 — Configuring IAM users as Masters
  • Part 4 — Packaging from source code
  • Part 5 — Publishing a container image to ECR
  • Part 6 — Deploying to EKS from an image in ECR

Continuing our series, we will now talk about how to deploy to EKS from an image in ECR.

Part 6 — Deploying to EKS from an image in ECR

DEPLOYING TO EKS FROM AN IMAGE IN ECR

  • First, you need to create two YAML files for the Kubernetes deploy: the “deployment” and the “service”.
  • To apply the deployment:
kubectl apply -f deployment.yaml
  • After deploying the applications, you can list the deployments:
kubectl get deployments
  • Next, create the services.
kubectl apply -f service.yaml
  • After creating the applications’ services, you can list them:
kubectl get svc
  • To remove the services or the deployments, just go to the folders containing the .yaml files and run:
kubectl delete -f service.yaml
kubectl delete -f deployment.yaml

Deployment.yaml

apiVersion: apps/v1
  kind: Deployment
  metadata:
  name: painel
spec:
  selector:
  matchLabels:
  run: painel-backend
replicas: 2
  template:
  metadata:
    labels:
    run: painel-backend
spec:
  containers:
    - name: painel
    image: <informar o caminho da imagem>
  ports:
    - containerPort: 8080
    protocol: TCP

Service.yaml

apiVersion: v1
  kind: Service
  metadata:
  creationTimestamp: null
  name: painel-backend
spec:
  ports:
    - port: 8081
    nodePort: 31479
    protocol: TCP
    targetPort: 8080
selector:
  run: painel-backend
  type: LoadBalancer

With this post, we have reached the end of our series on implementing Amazon Elastic Kubernetes Service: From Zero to Deploy.

I hope you enjoyed it.

Until next time! =)

Comments

Every comment is moderated before it appears here. Nothing is published automatically.

Loading…