Skip to content

Instantly share code, notes, and snippets.

@junoteam
Created March 27, 2020 17:56
Show Gist options
  • Save junoteam/3244c87acdfa447988acc56dff28a0be to your computer and use it in GitHub Desktop.
Save junoteam/3244c87acdfa447988acc56dff28a0be to your computer and use it in GitHub Desktop.
Kubernetes deployment file for Go application
apiVersion: v1
kind: List
items:
- apiVersion: v1
kind: Service # K8s Service
metadata:
name: simple-web-app-svc
labels:
app: simple-web-app
spec:
type: NodePort
selector:
app: simple-web-app
color: blue # labels for blue / green deployments
ports:
- protocol: TCP
name: http
port: 8080
targetPort: 8080
# nodePort: 30000 # setup of static nodePort
- apiVersion: apps/v1
kind: Deployment # K8s Deployment
metadata:
name: simple-web-app
labels:
app: simple-web-app
spec:
replicas: 3
selector:
matchLabels:
app: simple-web-app
progressDeadlineSeconds: 120
template:
metadata:
labels:
app: simple-web-app
color: blue # labels for blue / green deployments
spec:
containers:
- name: simple-web-app
image: mothes/simplewebapp
imagePullPolicy: Always
ports:
- containerPort: 8080
livenessProbe:
httpGet:
path: /ping
port: 8080
readinessProbe:
httpGet:
path: /ping
port: 8080
env:
- name: ENV
value: "dev"
resources:
requests:
cpu: "100m"
memory: "128Mi"
limits:
cpu: "200m"
memory: "256Mi"
imagePullSecrets:
- name: regcred
restartPolicy: Always
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment