Skip to content

Commit

Permalink
deploy grpc to eks
Browse files Browse the repository at this point in the history
  • Loading branch information
phamlequang committed Oct 28, 2023
1 parent 62f7819 commit 6e5229d
Show file tree
Hide file tree
Showing 8 changed files with 32 additions and 19 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ jobs:
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -t $ECR_REGISTRY/$ECR_REPOSITORY:latest .
docker push -a $ECR_REGISTRY/$ECR_REPOSITORY
# - name: Update kube config
# run: aws eks update-kubeconfig --name simple-bank --region eu-west-1

# - name: Deploy image to Amazon EKS
# run: |
# kubectl apply -f eks/aws-auth.yaml
# kubectl apply -f eks/deployment.yaml
# kubectl apply -f eks/service.yaml
# kubectl apply -f eks/issuer.yaml
# kubectl apply -f eks/ingress.yaml
- name: Update kube config
run: aws eks update-kubeconfig --name simple-bank --region eu-west-1

- name: Deploy image to Amazon EKS
run: |
kubectl apply -f eks/aws-auth.yaml
kubectl apply -f eks/deployment.yaml
kubectl apply -f eks/service.yaml
kubectl apply -f eks/issuer.yaml
kubectl apply -f eks/ingress.yaml
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ COPY start.sh .
COPY wait-for.sh .
COPY db/migration ./db/migration

EXPOSE 8080
EXPOSE 8080 9090
CMD [ "/app/main" ]
ENTRYPOINT [ "/app/start.sh" ]
2 changes: 1 addition & 1 deletion eks/aws-auth.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ metadata:
namespace: kube-system
data:
mapUsers: |
- userarn: arn:aws:iam::095420225348:user/github-ci
- userarn: arn:aws:iam::760486049168:user/github-ci
username: github-ci
groups:
- system:masters
6 changes: 5 additions & 1 deletion eks/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@ spec:
spec:
containers:
- name: simple-bank-api
image: 095420225348.dkr.ecr.eu-west-1.amazonaws.com/simplebank:latest
image: 760486049168.dkr.ecr.eu-west-1.amazonaws.com/simplebank:latest
imagePullPolicy: Always
ports:
- containerPort: 8080
name: http-server
- containerPort: 9090
name: grpc-server

10 changes: 6 additions & 4 deletions eks/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ spec:
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: simple-bank-ingress
name: simple-bank-ingress-grpc
annotations:
cert-manager.io/cluster-issuer: letsencrypt
nginx.ingress.kubernetes.io/ssl-redirect: "true"
nginx.ingress.kubernetes.io/backend-protocol: "GRPC"
spec:
ingressClassName: nginx
rules:
- host: "api.simple-bank.org"
- host: "api.simplebanktest.com"
http:
paths:
- pathType: Prefix
Expand All @@ -23,8 +25,8 @@ spec:
service:
name: simple-bank-api-service
port:
number: 80
number: 90
tls:
- hosts:
- api.simple-bank.org
- api.simplebanktest.com
secretName: simple-bank-api-cert
2 changes: 2 additions & 0 deletions eks/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
kubectl apply -f https://raw.githubusercontent.com/kubernetes/ingress-nginx/controller-v1.8.2/deploy/static/provider/aws/deploy.yaml
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/v1.13.1/cert-manager.yaml
2 changes: 1 addition & 1 deletion eks/issuer.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,4 @@ spec:
solvers:
- http01:
ingress:
class: nginx
ingressClassName: nginx
7 changes: 6 additions & 1 deletion eks/service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,10 @@ spec:
ports:
- protocol: TCP
port: 80
targetPort: 8080
targetPort: http-server
name: http-service
- protocol: TCP
port: 90
targetPort: grpc-server
name: grpc-service
type: ClusterIP

0 comments on commit 6e5229d

Please sign in to comment.