Managing kubernetes environments with kustomize

kube/
-dev/
-deployment.yaml
-service.yaml
-ingress.yaml
-staging/
-deployment.yaml
-service.yaml
-ingress.yaml
-prod/
-deployment.yaml
-service.yaml
-ingress.yaml
kube/
-base/
-overlays/
-dev/
-staging/
-prod/
resources:
- deployment.yaml
- service.yaml
- ingress.yaml
- configmap.yaml
resources:
- ../../base
patchesJson6902:
- target:
group: extensions
version: v1beta1
kind: Ingress
name: nginx
path: ingress_patch.yaml
commonLabels:
app: dev-nginx
namespace: dev
configMapGenerator:
- name: nginx
behaviour: merge
literals:
- ENV=dev
- op: replace
path: /spec/rules/0/host
value: dev-nginx.mydomain.com
containers:
- name: nginx
envFrom:
configMapRef:
name: nginx
apiVersion: v1
data:
DB_HOST: postgres
DB_HOST: "8081"
kind: ConfigMap
metadata:
name: nginx
>>>kustomize build overlays/devapiVersion: v1
data:
DB_HOST: "8081"
ENV: dev
kind: ConfigMap
metadata:
annotations: {}
labels:
app: dev-nginx
name: nginx
namespace: dev
---
apiVersion: v1
kind: Service
metadata:
labels:
app: dev-nginx
name: nginx
namespace: dev
spec:
ports:
- name: http-app
port: 80
selector:
app: dev-nginx
---
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
labels:
app: dev-nginx
name: nginx
namespace: dev
spec:
metadata:
labels:
app: nginx
selector:
matchLabels:
app: dev-nginx
template:
metadata:
labels:
app: dev-nginx
spec:
containers:
- image: nginx:latest
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
name: nginx
ports:
- containerPort: 80
readinessProbe:
httpGet:
path: /
port: 80
initialDelaySeconds: 10
resources:
limits:
memory: 500Mi
requests:
cpu: 100m
memory: 100Mi
imagePullSecrets:
- name: gitlab
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
annotations:
ingress.kubernetes.io/whitelist-source-range: 0.0.0.0/0
ingress.kubernetes.io/whitelist-x-forwarded-for: "true"
labels:
app: dev-nginx
name: nginx
namespace: dev
spec:
rules:
- host: dev-nginx.mydomain.com
http:
paths:
- backend:
serviceName: nginx
servicePort: http
path: /
replicas:
- name: nginx
count: 3
images:
- name: nginx
newTag: 6b654da03c0e
namePrefix: prod-

--

--

--

DevOps Engineer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

DNS panic attacks in Kubernetes (EKS)

Engineering an Income Model at Nova Credit

IaC World: Terraform 101

What are Loops in Java

OriginTrail v6 bounty program: Help launch the most advanced Decentralized Knowledge Graph yet!

Implementing MVVM in Android with Jetpack and Dependency Injection — Part 1

We Need to Make Our Logs Useful

The Observability Conundrum

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alex Lundberg

Alex Lundberg

DevOps Engineer

More from Medium

Create and Deploy a LAMP stack as a Helm Chart

ExternalDNS with EKS and Route53

Kubernetes Architecture Terminology in a 3 min read. Professional Friendly.

Learn Kubernetes: Secrets — Create a generic secret