Skip to content

Commit

Permalink
chore: add k8s objects for deployment and service
Browse files Browse the repository at this point in the history
  • Loading branch information
aseerkt committed Apr 13, 2024
1 parent f4de9ce commit fc027da
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 2 deletions.
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
- [golang-migrate](https://github.com/golang-migrate/migrate/tree/master/cmd/migrate)
- sqlc
- mockgen
- AWS CLI
- AWS CLI - v2
- kubectl
- eksctl
- minikube

## Getting Started
Expand All @@ -28,4 +29,10 @@ make createdb
make migrateup
```

For more scripts checkout [`Makefile`](/Makefile)
For more scripts checkout [`Makefile`](/Makefile)

# Deployment


- Create IAM user
- Create EKS Cluster using [eksctl](https://docs.aws.amazon.com/eks/latest/userguide/getting-started-eksctl.html)
74 changes: 74 additions & 0 deletions cluster.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/eksctl-io/eksctl/d53aa6ca65414a5533b37c60b4f4c39dcb9094ef/pkg/apis/eksctl.io/v1alpha5/assets/schema.json
accessConfig:
authenticationMode: API_AND_CONFIG_MAP
apiVersion: eksctl.io/v1alpha5
availabilityZones:
- ap-south-1a
- ap-south-1b
- ap-south-1c
cloudWatch:
clusterLogging: {}
iam:
vpcResourceControllerPolicy: true
withOIDC: false
kind: ClusterConfig
kubernetesNetworkConfig:
ipFamily: IPv4
managedNodeGroups:
- amiFamily: AmazonLinux2
desiredCapacity: 2
disableIMDSv1: true
disablePodIMDS: false
iam:
withAddonPolicies:
albIngress: false
appMesh: false
appMeshPreview: false
autoScaler: false
awsLoadBalancerController: false
certManager: false
cloudWatch: false
ebs: false
efs: false
externalDNS: false
fsx: false
imageBuilder: false
xRay: false
instanceSelector: {}
labels:
alpha.eksctl.io/cluster-name: simplebank
alpha.eksctl.io/nodegroup-name: ng-ed9ef7b5
maxSize: 2
minSize: 2
name: ng-ed9ef7b5
privateNetworking: false
releaseVersion: ""
securityGroups:
withLocal: false
withShared: false
ssh:
allow: false
publicKeyPath: ""
tags:
alpha.eksctl.io/nodegroup-name: ng-ed9ef7b5
alpha.eksctl.io/nodegroup-type: managed
volumeIOPS: 3000
volumeSize: 80
volumeThroughput: 125
volumeType: gp3
metadata:
name: simplebank
region: ap-south-1
version: "1.29"
privateCluster:
enabled: false
skipEndpointCreation: false
vpc:
autoAllocateIPv6: false
cidr: 192.168.0.0/16
clusterEndpoints:
privateAccess: true
publicAccess: true
manageSharedNodeSecurityGroupRules: true
nat:
gateway: Single
36 changes: 36 additions & 0 deletions eks/deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: simplebank-deployment
namespace: simplebank
labels:
app: eks-simplebank
spec:
replicas: 3
selector:
matchLabels:
app: eks-simplebank
template:
metadata:
labels:
app: eks-simplebank
spec:
affinity:
nodeAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
nodeSelectorTerms:
- matchExpressions:
- key: kubernetes.io/arch
operator: In
values:
- amd64
- arm64
containers:
- name: simplebank
image: $IMAGE
ports:
- name: http
containerPort: 8080
imagePullPolicy: IfNotPresent
nodeSelector:
kubernetes.io/os: linux
14 changes: 14 additions & 0 deletions eks/service.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
apiVersion: v1
kind: Service
metadata:
name: simplebank-service
namespace: simplebank
labels:
app: eks-simplebank
spec:
selector:
app: eks-simplebank
ports:
- protocol: TCP
port: 8080
targetPort: 8080

0 comments on commit fc027da

Please sign in to comment.