mirror of
https://github.com/marcel-dempers/docker-development-youtube-series.git
synced 2025-06-06 17:01:30 +00:00
commit
befe92eb39
10
kubernetes/kustomize/application/configmap.yaml
Normal file
10
kubernetes/kustomize/application/configmap.yaml
Normal file
@ -0,0 +1,10 @@
|
||||
# apiVersion: v1
|
||||
# kind: ConfigMap
|
||||
# metadata:
|
||||
# name: example-config
|
||||
# namespace: example
|
||||
# data:
|
||||
# config.json: |
|
||||
# {
|
||||
# "environment" : "dev"
|
||||
# }
|
36
kubernetes/kustomize/application/deployment.yaml
Normal file
36
kubernetes/kustomize/application/deployment.yaml
Normal 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
|
5
kubernetes/kustomize/application/kustomization.yaml
Normal file
5
kubernetes/kustomize/application/kustomization.yaml
Normal file
@ -0,0 +1,5 @@
|
||||
resources:
|
||||
- namespace.yaml
|
||||
- deployment.yaml
|
||||
- service.yaml
|
||||
- configmap.yaml
|
4
kubernetes/kustomize/application/namespace.yaml
Normal file
4
kubernetes/kustomize/application/namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: example
|
16
kubernetes/kustomize/application/service.yaml
Normal file
16
kubernetes/kustomize/application/service.yaml
Normal 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
|
@ -0,0 +1,4 @@
|
||||
bases:
|
||||
- ../../application
|
||||
patches:
|
||||
- replica_count.yaml
|
@ -0,0 +1,6 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: example-deploy
|
||||
spec:
|
||||
replicas: 4
|
@ -0,0 +1,4 @@
|
||||
{
|
||||
"environment" : "prod",
|
||||
"hello": "world"
|
||||
}
|
12
kubernetes/kustomize/environments/production/env.yaml
Normal file
12
kubernetes/kustomize/environments/production/env.yaml
Normal 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
|
@ -0,0 +1,16 @@
|
||||
bases:
|
||||
- ../../application
|
||||
patches:
|
||||
- replica_count.yaml
|
||||
- resource_limits.yaml
|
||||
configMapGenerator:
|
||||
- name: example-config
|
||||
namespace: example
|
||||
#behavior: replace
|
||||
files:
|
||||
- configs/config.json
|
||||
patchesStrategicMerge:
|
||||
- env.yaml
|
||||
images:
|
||||
- name: aimvector/python
|
||||
newTag: 1.0.1
|
@ -0,0 +1,6 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: example-deploy
|
||||
spec:
|
||||
replicas: 6
|
@ -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"
|
40
kubernetes/kustomize/readme.md
Normal file
40
kubernetes/kustomize/readme.md
Normal 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
|
||||
```
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user