Agregando Clase 6
This commit is contained in:
parent
1746097811
commit
1742333d1b
4
Clase 6/Ejercicio/00-namespace.yaml
Normal file
4
Clase 6/Ejercicio/00-namespace.yaml
Normal file
@ -0,0 +1,4 @@
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: node-app
|
6
Clase 6/Ejercicio/01-storageClass.yaml
Normal file
6
Clase 6/Ejercicio/01-storageClass.yaml
Normal file
@ -0,0 +1,6 @@
|
||||
kind: StorageClass
|
||||
apiVersion: storage.k8s.io/v1
|
||||
metadata:
|
||||
name: my-local-storage
|
||||
provisioner: kubernetes.io/no-provisioner
|
||||
volumeBindingMode: WaitForFirstConsumer
|
21
Clase 6/Ejercicio/02-pv.yaml
Normal file
21
Clase 6/Ejercicio/02-pv.yaml
Normal file
@ -0,0 +1,21 @@
|
||||
apiVersion: v1
|
||||
kind: PersistentVolume
|
||||
metadata:
|
||||
name: my-local-pv
|
||||
spec:
|
||||
capacity:
|
||||
storage: 3Gi
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
persistentVolumeReclaimPolicy: Retain
|
||||
storageClassName: my-local-storage
|
||||
local:
|
||||
path: /mnt
|
||||
nodeAffinity:
|
||||
required:
|
||||
nodeSelectorTerms:
|
||||
- matchExpressions:
|
||||
- key: kubernetes.io/hostname
|
||||
operator: In
|
||||
values:
|
||||
- docker-desktop
|
12
Clase 6/Ejercicio/03-pvc.yaml
Normal file
12
Clase 6/Ejercicio/03-pvc.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: node-app-mongodb-pvc
|
||||
namespace: node-app
|
||||
spec:
|
||||
storageClassName: my-local-storage
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 3Gi
|
13
Clase 6/Ejercicio/04-configmap.yaml
Normal file
13
Clase 6/Ejercicio/04-configmap.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: node-app-configmap
|
||||
namespace: node-app
|
||||
data:
|
||||
#WHITELIST URLS Default to http://localhost
|
||||
WHITELIST_URLS: http://localhost,http://localhost:4000
|
||||
PORT: "4000"
|
||||
HOST_MONGO: mongodb-node-app-svc
|
||||
PORT_MONGO: "27017"
|
||||
DB_MONGO: app_db
|
||||
|
9
Clase 6/Ejercicio/05-secret.yaml
Normal file
9
Clase 6/Ejercicio/05-secret.yaml
Normal file
@ -0,0 +1,9 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: node-app-secret
|
||||
namespace: node-app
|
||||
type: Opaque
|
||||
data:
|
||||
USER_MONGO: cm9vdA==
|
||||
PASSWORD_MONGO: MTIzNA==
|
16
Clase 6/Ejercicio/06-service.yaml
Normal file
16
Clase 6/Ejercicio/06-service.yaml
Normal file
@ -0,0 +1,16 @@
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: app-service
|
||||
namespace: node-app
|
||||
spec:
|
||||
ports:
|
||||
- name: 80-tcp
|
||||
port: 80
|
||||
protocol: TCP
|
||||
targetPort: 4000
|
||||
selector:
|
||||
com.docker.project: node-app
|
||||
type: LoadBalancer
|
||||
status:
|
||||
loadBalancer: {}
|
13
Clase 6/Ejercicio/07-db-svc.yaml
Normal file
13
Clase 6/Ejercicio/07-db-svc.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
kind: Service
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: mongodb-node-app-svc
|
||||
namespace: node-app
|
||||
spec:
|
||||
selector:
|
||||
app: mongodb-node-app
|
||||
ports:
|
||||
- protocol: TCP
|
||||
name: mongodb-node-app
|
||||
port: 27017
|
||||
targetPort: 27017
|
58
Clase 6/Ejercicio/08-deployment.yaml
Normal file
58
Clase 6/Ejercicio/08-deployment.yaml
Normal file
@ -0,0 +1,58 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: node-app
|
||||
namespace: node-app
|
||||
spec:
|
||||
replicas: 1
|
||||
selector:
|
||||
matchLabels:
|
||||
com.docker.project: node-app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
com.docker.project: node-app
|
||||
spec:
|
||||
containers:
|
||||
- name: node-app
|
||||
image: aleleba/example-app:2.0.1
|
||||
imagePullPolicy: Always
|
||||
env:
|
||||
- name: PORT
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: node-app-configmap
|
||||
key: PORT
|
||||
- name: WHITELIST_URLS
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: node-app-configmap
|
||||
key: WHITELIST_URLS
|
||||
- name: HOST_MONGO
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: node-app-configmap
|
||||
key: HOST_MONGO
|
||||
- name: PORT_MONGO
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: node-app-configmap
|
||||
key: PORT_MONGO
|
||||
- name: DB_MONGO
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: node-app-configmap
|
||||
key: DB_MONGO
|
||||
- name: USER_MONGO
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: USER_MONGO
|
||||
- name: PASSWORD_MONGO
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: PASSWORD_MONGO
|
||||
ports:
|
||||
- containerPort: 80
|
||||
protocol: TCP
|
56
Clase 6/Ejercicio/09-mongodb-stayfullset.yaml
Normal file
56
Clase 6/Ejercicio/09-mongodb-stayfullset.yaml
Normal file
@ -0,0 +1,56 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: mongodb-node-app
|
||||
namespace: node-app
|
||||
spec:
|
||||
replicas: 1
|
||||
serviceName: mongodb-node-app-svc
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mongodb-node-app
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mongodb-node-app
|
||||
spec:
|
||||
containers:
|
||||
- name: mongodb-node-app
|
||||
image: mongo:5.0.12
|
||||
imagePullPolicy: Always
|
||||
ports:
|
||||
- containerPort: 27017
|
||||
env:
|
||||
- name: MONGO_DATA_DIR
|
||||
value: /data/db
|
||||
- name: MONGO_LOG_DIR
|
||||
value: /dev/null
|
||||
- name: MONGODB_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: USER_MONGO
|
||||
- name: MONGO_INITDB_ROOT_USERNAME
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: USER_MONGO
|
||||
- name: MONGODB_PASS
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: PASSWORD_MONGO
|
||||
- name: MONGO_INITDB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: node-app-secret
|
||||
key: PASSWORD_MONGO
|
||||
- name: MONGO_INITDB_DATABASE
|
||||
value: admin
|
||||
volumeMounts:
|
||||
- mountPath: /data/db
|
||||
name: node-app-mongodb-pvc
|
||||
volumes:
|
||||
- name: node-app-mongodb-pvc
|
||||
persistentVolumeClaim:
|
||||
claimName: node-app-mongodb-pvc
|
@ -0,0 +1 @@
|
||||
kubectl delete all --all -n {namespace}
|
Loading…
Reference in New Issue
Block a user