Skip to content

Instantly share code, notes, and snippets.

@itsmunim
Last active December 3, 2021 08:48
Show Gist options
  • Save itsmunim/37a11b85d08d8f7dcb799526f3943887 to your computer and use it in GitHub Desktop.
Save itsmunim/37a11b85d08d8f7dcb799526f3943887 to your computer and use it in GitHub Desktop.
apiVersion: apps/v1
kind: Deployment
metadata:
name: api
labels:
app: api
spec:
replicas: 3
selector:
matchLabels:
app: api
template:
metadata:
labels:
app: api
spec:
imagePullSecrets:
- name: docker-registry-creds
containers:
- name: api
image: IMAGE_PLACEHOLDER
envFrom:
- configMapRef:
name: api
# This pattern of defining resource(i.e. no cpu limit, same request and limit for mem) is actually
# a recommended practice. Details-
# https://cloud.google.com/architecture/best-practices-for-running-cost-effective-kubernetes-applications-on-gke#set_appropriate_resource_requests_and_limits
resources:
limits:
memory: 256Mi
requests:
memory: 256Mi
cpu: 100m
ports:
- name: http
containerPort: 8080
---
# Service specific environment vars
apiVersion: v1
kind: ConfigMap
metadata:
name: api
data:
NODE_ENV: dev
---
apiVersion: v1
kind: Service
metadata:
name: api
spec:
selector:
app: api
ports:
- port: 80
targetPort: 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment