Skip to content

Instantly share code, notes, and snippets.

@BrianMehrman
Last active August 12, 2021 19:04
Show Gist options
  • Save BrianMehrman/591808edc0c7e1cf7a5d754ffbac3700 to your computer and use it in GitHub Desktop.
Save BrianMehrman/591808edc0c7e1cf7a5d754ffbac3700 to your computer and use it in GitHub Desktop.
These are instructions to start a mongo db deployment. Assuming these files are all in the same directory you can run this ``` kubectl apply -k . ```
apiVersion: v1
kind: ConfigMap
metadata:
name: mongo-configmap
labels:
app: meal-plan-app
component: mongo-db
data:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: rootR0xks
apiVersion: apps/v1
kind: Deployment
metadata:
name: mongo-db
labels:
app: meal-plan-app
component: mongo-db
spec:
replicas: 1
selector:
matchLabels:
app: meal-plan-app
component: mongo-db
template:
metadata:
labels:
app: meal-plan-app
component: mongo-db
spec:
containers:
- name: mongo-db
image: mongo:4.0
command:
- mongod
resources:
requests:
memory: "64Mi"
cpu: "250m"
limits:
memory: "256Mi"
cpu: "500m"
envFrom:
- configMapRef:
name: mongo-configmap
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- configmap.yaml
- deployment.yaml
- service.yaml
kind: Service
apiVersion: v1
metadata:
name: mongo-db
spec:
selector:
app: meal-plan-app
component: mongo-db
type: NodePort
ports:
- name: db
port: 27017
targetPort: 27017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment