fichero YAML del Pelado Nerd
This commit is contained in:
parent
3dcac355d5
commit
63d1ea6b39
8
yaml-del-pelado/01-pod.yaml
Normal file
8
yaml-del-pelado/01-pod.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
37
yaml-del-pelado/02-pod.yaml
Normal file
37
yaml-del-pelado/02-pod.yaml
Normal file
@ -0,0 +1,37 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
env:
|
||||
- name: MI_VARIABLE
|
||||
value: "pelado"
|
||||
- name: MI_OTRA_VARIABLE
|
||||
value: "pelade"
|
||||
- name: DD_AGENT_HOST
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "200m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "500m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 80
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
ports:
|
||||
- containerPort: 80
|
45
yaml-del-pelado/03-daemonset.yaml
Normal file
45
yaml-del-pelado/03-daemonset.yaml
Normal file
@ -0,0 +1,45 @@
|
||||
apiVersion: apps/v1
|
||||
kind: DaemonSet
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
env:
|
||||
- name: MI_VARIABLE
|
||||
value: "pelado"
|
||||
- name: MI_OTRA_VARIABLE
|
||||
value: "pelade"
|
||||
- name: DD_AGENT_HOST
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "200m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "500m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 80
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
ports:
|
||||
- containerPort: 80
|
46
yaml-del-pelado/04-deployment.yaml
Normal file
46
yaml-del-pelado/04-deployment.yaml
Normal file
@ -0,0 +1,46 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: nginx-deployment
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: nginx
|
||||
replicas: 2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
env:
|
||||
- name: MI_VARIABLE
|
||||
value: "pelado"
|
||||
- name: MI_OTRA_VARIABLE
|
||||
value: "pelade"
|
||||
- name: DD_AGENT_HOST
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: status.hostIP
|
||||
resources:
|
||||
requests:
|
||||
memory: "64Mi"
|
||||
cpu: "200m"
|
||||
limits:
|
||||
memory: "128Mi"
|
||||
cpu: "500m"
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: 80
|
||||
initialDelaySeconds: 5
|
||||
periodSeconds: 10
|
||||
livenessProbe:
|
||||
tcpSocket:
|
||||
port: 80
|
||||
initialDelaySeconds: 15
|
||||
periodSeconds: 20
|
||||
ports:
|
||||
- containerPort: 80
|
34
yaml-del-pelado/05-statefulset.yaml
Normal file
34
yaml-del-pelado/05-statefulset.yaml
Normal file
@ -0,0 +1,34 @@
|
||||
apiVersion: apps/v1
|
||||
kind: StatefulSet
|
||||
metadata:
|
||||
name: my-csi-app-set
|
||||
spec:
|
||||
selector:
|
||||
matchLabels:
|
||||
app: mypod
|
||||
serviceName: "my-frontend"
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: mypod
|
||||
spec:
|
||||
containers:
|
||||
- name: my-frontend
|
||||
image: busybox
|
||||
args:
|
||||
- sleep
|
||||
- infinity
|
||||
volumeMounts:
|
||||
- mountPath: "/data"
|
||||
name: csi-pvc
|
||||
volumeClaimTemplates:
|
||||
- metadata:
|
||||
name: csi-pvc
|
||||
spec:
|
||||
accessModes:
|
||||
- ReadWriteOnce
|
||||
resources:
|
||||
requests:
|
||||
storage: 5Gi
|
||||
storageClassName: do-block-storage
|
11
yaml-del-pelado/06-randompod.yaml
Normal file
11
yaml-del-pelado/06-randompod.yaml
Normal file
@ -0,0 +1,11 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: ubuntu
|
||||
spec:
|
||||
containers:
|
||||
- name: ubuntu
|
||||
image: ubuntu
|
||||
args:
|
||||
- sleep
|
||||
- infinity
|
31
yaml-del-pelado/07-hello-deployment-svc-clusterIP.yaml
Normal file
31
yaml-del-pelado/07-hello-deployment-svc-clusterIP.yaml
Normal file
@ -0,0 +1,31 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
role: hello
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
role: hello
|
||||
spec:
|
||||
containers:
|
||||
- name: hello
|
||||
image: gcr.io/google-samples/hello-app:1.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
role: hello
|
33
yaml-del-pelado/08-hello-deployment-svc-nodePort.yaml
Normal file
33
yaml-del-pelado/08-hello-deployment-svc-nodePort.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
role: hello
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
role: hello
|
||||
spec:
|
||||
containers:
|
||||
- name: hello
|
||||
image: gcr.io/google-samples/hello-app:1.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
type: NodePort
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
nodePort: 30000
|
||||
selector:
|
||||
role: hello
|
32
yaml-del-pelado/09-hello-deployment-svc-loadBalancer.yaml
Normal file
32
yaml-del-pelado/09-hello-deployment-svc-loadBalancer.yaml
Normal file
@ -0,0 +1,32 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
role: hello
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
role: hello
|
||||
spec:
|
||||
containers:
|
||||
- name: hello
|
||||
image: gcr.io/google-samples/hello-app:1.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello
|
||||
spec:
|
||||
type: LoadBalancer
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
role: hello
|
65
yaml-del-pelado/10-hello-v1-v2-deployment-svc.yaml
Normal file
65
yaml-del-pelado/10-hello-v1-v2-deployment-svc.yaml
Normal file
@ -0,0 +1,65 @@
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello-v1
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
role: hello-v1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
role: hello-v1
|
||||
spec:
|
||||
containers:
|
||||
- name: hello-v1
|
||||
image: gcr.io/google-samples/hello-app:1.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
|
||||
apiVersion: apps/v1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: hello-v2
|
||||
spec:
|
||||
replicas: 3
|
||||
selector:
|
||||
matchLabels:
|
||||
role: hello-v2
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
role: hello-v2
|
||||
spec:
|
||||
containers:
|
||||
- name: hello-v2
|
||||
image: gcr.io/google-samples/hello-app:2.0
|
||||
ports:
|
||||
- containerPort: 8080
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello-v1
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
role: hello-v1
|
||||
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: hello-v2
|
||||
spec:
|
||||
ports:
|
||||
- port: 8080
|
||||
targetPort: 8080
|
||||
selector:
|
||||
role: hello-v2
|
22
yaml-del-pelado/11-hello-ingress.yaml
Normal file
22
yaml-del-pelado/11-hello-ingress.yaml
Normal file
@ -0,0 +1,22 @@
|
||||
apiVersion: networking.k8s.io/v1
|
||||
kind: Ingress
|
||||
metadata:
|
||||
name: hello-app
|
||||
spec:
|
||||
rules:
|
||||
- http:
|
||||
paths:
|
||||
- path: /v1
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hello-v1
|
||||
port:
|
||||
number: 8080
|
||||
- path: /v2
|
||||
pathType: Prefix
|
||||
backend:
|
||||
service:
|
||||
name: hello-v2
|
||||
port:
|
||||
number: 8080
|
17
yaml-del-pelado/12-configmap.yaml
Normal file
17
yaml-del-pelado/12-configmap.yaml
Normal file
@ -0,0 +1,17 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: game-demo
|
||||
data:
|
||||
# property-like keys; each key maps to a simple value
|
||||
player_initial_lives: "3"
|
||||
ui_properties_file_name: "user-interface.properties"
|
||||
#
|
||||
# file-like keys
|
||||
game.properties: |
|
||||
enemy.types=aliens,monsters
|
||||
player.maximum-lives=5
|
||||
user-interface.properties: |
|
||||
color.good=purple
|
||||
color.bad=yellow
|
||||
allow.textmode=true
|
33
yaml-del-pelado/13-pod-configmap.yaml
Normal file
33
yaml-del-pelado/13-pod-configmap.yaml
Normal file
@ -0,0 +1,33 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
env:
|
||||
# Define the environment variable
|
||||
- name: PLAYER_INITIAL_LIVES # Nombre de la variable
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: game-demo # El confimap desde donde vienen los valores
|
||||
key: player_initial_lives # La key que vamos a usar
|
||||
- name: UI_PROPERTIES_FILE_NAME
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: game-demo
|
||||
key: ui_properties_file_name
|
||||
volumeMounts:
|
||||
- name: config
|
||||
mountPath: "/config"
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: config
|
||||
configMap:
|
||||
name: game-demo # el nombre del configmap que queremos montar
|
||||
items: # Un arreglo de keys del configmap para crear como archivos
|
||||
- key: "game.properties"
|
||||
path: "game.properties"
|
||||
- key: "user-interface.properties"
|
||||
path: "user-interface.properties"
|
12
yaml-del-pelado/14-secret.yaml
Normal file
12
yaml-del-pelado/14-secret.yaml
Normal file
@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
kind: Secret
|
||||
metadata:
|
||||
name: db-credentials
|
||||
type: Opaque
|
||||
data:
|
||||
username: YWRtaW4=
|
||||
password: c3VwM3JwYXNzdzByZAo=
|
||||
|
||||
# Esto se puede crear a mano:
|
||||
# kubectl create secret generic db-credentials --from-literal=username=admin --from-literal=password=sup3rpassw0rd
|
||||
# Docs: https://kubernetes.io/es/docs/concepts/configuration/secret/
|
23
yaml-del-pelado/15-pod-secret.yaml
Normal file
23
yaml-del-pelado/15-pod-secret.yaml
Normal file
@ -0,0 +1,23 @@
|
||||
apiVersion: v1
|
||||
kind: Pod
|
||||
metadata:
|
||||
name: nginx
|
||||
spec:
|
||||
containers:
|
||||
- name: nginx
|
||||
image: nginx:alpine
|
||||
env:
|
||||
- name: MI_VARIABLE
|
||||
value: "pelado"
|
||||
- name: MYSQL_USER
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: db-credentials
|
||||
key: username
|
||||
- name: MYSQL_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: db-credentials
|
||||
key: password
|
||||
ports:
|
||||
- containerPort: 80
|
18
yaml-del-pelado/kustomization.yaml
Normal file
18
yaml-del-pelado/kustomization.yaml
Normal file
@ -0,0 +1,18 @@
|
||||
apiVersion: kustomize.config.k8s.io/v1beta1
|
||||
kind: Kustomization
|
||||
|
||||
commonLabels:
|
||||
app: ejemplo
|
||||
|
||||
resources:
|
||||
- 15-pod-secret.yaml
|
||||
|
||||
secretGenerator:
|
||||
- name: db-credentials
|
||||
literals:
|
||||
- username=admin
|
||||
- password=secr3tpassw0rd!
|
||||
|
||||
images:
|
||||
- name: nginx
|
||||
newTag: latest
|
Loading…
Reference in New Issue
Block a user