add kustomize

This commit is contained in:
2023-03-15 11:24:41 +07:00
parent 5ffd029bee
commit f42422262a
18 changed files with 293 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: guestbook
labels:
app: &app frontend
spec:
replicas: 1
selector:
matchLabels:
app: *app
template:
metadata:
labels:
app: *app
spec:
containers:
- name: guestbook-app
image: nginx
resources:
requests:
cpu: 100m
memory: 100Mi
env:
- name: DB_PASSWORD
valueFrom:
secretKeyRef:
name: secret
key: DB_PASSWORD
- name: FRUIT
valueFrom:
secretKeyRef:
name: secret
key: FRUIT
- name: ROUTER_PASSWORD
valueFrom:
secretKeyRef:
name: secret
key: ROUTER_PASSWORD
- name: VEGETABLE
valueFrom:
secretKeyRef:
name: secret
key: VEGETABLE
ports:
- containerPort: 80
volumeMounts:
- name: config
mountPath: /mnt/config/config.ini
subPath: config.ini
readOnly: true
- name: secret
mountPath: /mnt/secret
readOnly: true
volumes:
- name: config
configMap:
name: config
defaultMode: 420
- name: secret
secret:
secretName: secret
items:
- key: longsecret.txt
path: longsecret.txt

View File

@@ -0,0 +1,8 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- service.yaml
- deployment.yaml
configMapGenerator:
- name: config

View File

@@ -0,0 +1,12 @@
apiVersion: v1
kind: Service
metadata:
name: guestbook
labels:
app: &app frontend
spec:
type: ClusterIP
ports:
- port: 80
selector:
app: *app