Skip to content

Commit

Permalink
Kubernetes yaml file for mongodb and online-store-app were added.
Browse files Browse the repository at this point in the history
  • Loading branch information
Sunagatov committed Feb 11, 2023
1 parent 01adfe9 commit e8327ea
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 17 deletions.
47 changes: 47 additions & 0 deletions kube/mongo.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: mongo-pvc
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 256Mi
---
apiVersion: v1
kind: Service
metadata:
name: mongo
spec:
selector:
app: mongo
ports:
- port: 27017
targetPort: 27017
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo
spec:
selector:
matchLabels:
app: mongo
template:
metadata:
labels:
app: mongo
spec:
containers:
- name: mongo
image: mongo:3.6.17-xenial
ports:
- containerPort: 27017
volumeMounts:
- name: storage
mountPath: /data/db
volumes:
- name: storage
persistentVolumeClaim:
claimName: mongo-pvc
36 changes: 19 additions & 17 deletions kube/online-store-kube.yaml → kube/online-store.yaml
Original file line number Diff line number Diff line change
@@ -1,33 +1,35 @@
apiVersion: v1 # Kubernetes API version
kind: Service # Kubernetes resource kind we are creating
metadata: # Metadata of the resource kind we are creating
name: online-store-app-service
spec:
selector:
app: online-store-app
ports:
- protocol: "TCP"
port: 8083 # The port that the service is running on in the cluster
targetPort: 8083 # The port exposed by the service
type: LoadBalancer # type of the service. LoadBalancer indicates that our service will be external.
---
apiVersion: apps/v1
kind: Deployment # Kubernetes resource kind we are creating
metadata:
name: online-store-app
spec:
replicas: 1 # Number of replicas that will be created for this deployment
selector:
matchLabels:
app: online-store-app
replicas: 1 # Number of replicas that will be created for this deployment
template:
metadata:
labels:
app: online-store-app
spec:
containers:
- name: online-store
image: zufarexplainedit/online-store:0.0.1 # Image that will be used to containers in the cluster
imagePullPolicy: IfNotPresent
image: zufarexplainedit/online-store:0.0.2 # Image that will be used to containers in the cluster
imagePullPolicy: Always
ports:
- containerPort: 8083 # The port that the container is running on in the cluster
- containerPort: 8083 # The port that the container is running on in the cluster
env:
- name: MONGO_URL
value: mongodb://mongo:27017/dev
---
apiVersion: v1 # Kubernetes API version
kind: Service # Kubernetes resource kind we are creating
metadata: # Metadata of the resource kind we are creating
name: online-store-app-service
spec:
selector:
app: online-store-app
ports:
- protocol: TCP
port: 8083 # The port that the service is running on in the cluster
targetPort: 8083 # The port exposed by the service

0 comments on commit e8327ea

Please sign in to comment.