This commit is contained in:
marcel-dempers 2020-07-05 10:40:00 +10:00
parent 45cd191f3c
commit 52f655f881
14 changed files with 179 additions and 0 deletions

View File

@ -0,0 +1,9 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: example-config
data:
config.json: |
{
"environment" : "dev"
}

View File

@ -0,0 +1,36 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deploy
namespace: example
labels:
app: example-app
annotations:
spec:
selector:
matchLabels:
app: example-app
replicas: 2
strategy:
type: RollingUpdate
rollingUpdate:
maxSurge: 1
maxUnavailable: 0
template:
metadata:
labels:
app: example-app
spec:
containers:
- name: example-app
image: aimvector/python:1.0.0
imagePullPolicy: Always
ports:
- containerPort: 5000
volumeMounts:
- name: config-volume
mountPath: /configs/
volumes:
- name: config-volume
configMap:
name: example-config

View File

@ -0,0 +1,5 @@
resources:
- namespace.yaml
- deployment.yaml
- service.yaml
- configmap.yaml

View File

@ -0,0 +1,4 @@
apiVersion: v1
kind: Namespace
metadata:
name: example

View File

@ -0,0 +1,16 @@
apiVersion: v1
kind: Service
metadata:
name: example-service
namespace: example
labels:
app: example-app
spec:
type: LoadBalancer
selector:
app: example-app
ports:
- protocol: TCP
name: http
port: 80
targetPort: 5000

View File

@ -0,0 +1,7 @@
bases:
- ../../application
patches:
- replica_count.yaml
images:
- name: aimvector/python
newTag: 1.0.1

View File

@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deploy
spec:
replicas: 4

View File

@ -0,0 +1,4 @@
{
"environment" : "prod",
"new" : "123"
}

View File

@ -0,0 +1,12 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deploy
spec:
template:
spec:
containers:
- name: example-app
env:
- name: ENVIRONMENT
value: Production

View File

@ -0,0 +1,13 @@
bases:
- ../../application
patches:
- replica_count.yaml
- resource_limits.yaml
configMapGenerator:
- name: example-config
namespace: example
behavior: replace
files:
- configs/config.json
patchesStrategicMerge:
- env.yaml

View File

@ -0,0 +1,6 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deploy
spec:
replicas: 6

View File

@ -0,0 +1,16 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: example-deploy
spec:
template:
spec:
containers:
- name: example-app
resources:
requests:
memory: "64Mi"
cpu: "50m"
limits:
memory: "256Mi"
cpu: "500m"

View File

@ -0,0 +1,5 @@
resources:
- application/namespace.yaml
- application/deployment.yaml
- application/service.yaml
- application/configmap.yaml

View File

@ -0,0 +1,40 @@
# The Basics
```
kubectl apply -f kubernetes/kustomize/application/namespace.yaml
kubectl apply -f kubernetes/kustomize/application/configmap.yaml
kubectl apply -f kubernetes/kustomize/application/deployment.yaml
kubectl apply -f kubernetes/kustomize/application/service.yaml
# OR
kubectl apply -f kubernetes/kustomize/application/
kubectl delete ns example
```
# Kustomize
## Build
```
kubectl kustomize .\kubernetes\kustomize\ | kubectl apply -f -
# OR
kubectl apply -k .\kubernetes\kustomize\
kubectl delete ns example
```
## Overlays
```
kubectl kustomize .\kubernetes\kustomize\environments\production | kubectl apply -f -
# OR
kubectl apply -k .\kubernetes\kustomize\environments\production
kubectl delete ns example
```