fichero YAML del Pelado Nerd

This commit is contained in:
Manuel Vergara 2022-09-19 18:31:05 +02:00
parent 3dcac355d5
commit 63d1ea6b39
16 changed files with 467 additions and 0 deletions

View File

@ -0,0 +1,8 @@
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:alpine

View 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

View 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

View 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

View 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

View File

@ -0,0 +1,11 @@
apiVersion: v1
kind: Pod
metadata:
name: ubuntu
spec:
containers:
- name: ubuntu
image: ubuntu
args:
- sleep
- infinity

View 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

View 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

View 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

View 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

View 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

View 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

View 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"

View 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/

View 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

View 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