Skip to content

Commit

Permalink
Add K8s manifests
Browse files Browse the repository at this point in the history
  • Loading branch information
jaguililla committed Dec 26, 2023
1 parent a698fb8 commit 52354fe
Show file tree
Hide file tree
Showing 6 changed files with 159 additions and 0 deletions.
10 changes: 10 additions & 0 deletions k8s/backend-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

apiVersion: v1
kind: ConfigMap

metadata:
name: backend-configmap

data:
bindAddress: "0.0.0.0"
mongodbUrl: "mongodb://mongodb/real_world"
50 changes: 50 additions & 0 deletions k8s/backend-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@

apiVersion: apps/v1
kind: Deployment

metadata:
annotations:
app: realworld
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
type: backend
labels:
io.kompose.service: backend
name: backend

spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: backend
template:
metadata:
annotations:
app: realworld
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
type: backend
labels:
io.kompose.network/real-world-default: "true"
io.kompose.service: backend
spec:
containers:
- env:
- name: bindAddress
valueFrom:
configMapKeyRef:
name: backend-configmap
key: bindAddress
- name: mongodbUrl
valueFrom:
configMapKeyRef:
name: backend-configmap
key: mongodbUrl
image: backend
name: backend
ports:
- containerPort: 2010
hostPort: 3090
protocol: TCP
resources: {}
restartPolicy: Always
21 changes: 21 additions & 0 deletions k8s/backend-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

apiVersion: v1
kind: Service

metadata:
annotations:
app: realworld
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
type: backend
labels:
io.kompose.service: backend
name: backend

spec:
ports:
- name: "3090"
port: 3090
targetPort: 2010
selector:
io.kompose.service: backend
44 changes: 44 additions & 0 deletions k8s/mongodb-deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

apiVersion: apps/v1
kind: Deployment

metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
labels:
io.kompose.service: mongodb
name: mongodb

spec:
replicas: 1
selector:
matchLabels:
io.kompose.service: mongodb
strategy:
type: Recreate
template:
metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
labels:
io.kompose.network/real-world-default: "true"
io.kompose.service: mongodb
spec:
containers:
- image: docker.io/mongo:7-jammy
name: mongodb
ports:
- containerPort: 27017
hostPort: 3010
protocol: TCP
resources: {}
volumeMounts:
- mountPath: /data/db
name: mongodb
restartPolicy: Always
volumes:
- name: mongodb
persistentVolumeClaim:
claimName: mongodb
15 changes: 15 additions & 0 deletions k8s/mongodb-persistentvolumeclaim.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

apiVersion: v1
kind: PersistentVolumeClaim

metadata:
labels:
io.kompose.service: mongodb
name: mongodb

spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 100Mi
19 changes: 19 additions & 0 deletions k8s/mongodb-service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

apiVersion: v1
kind: Service

metadata:
annotations:
kompose.cmd: kompose convert -f docker-compose.yml -o k8s
kompose.version: 1.31.0 (HEAD)
labels:
io.kompose.service: mongodb
name: mongodb

spec:
ports:
- name: "3010"
port: 3010
targetPort: 27017
selector:
io.kompose.service: mongodb

0 comments on commit 52354fe

Please sign in to comment.