Last active
October 12, 2022 13:55
-
-
Save roxsross/40195ac623bb169297d5b4b92a5b0ecb to your computer and use it in GitHub Desktop.
kubernetes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##Descargamos UBUNTU | |
FROM ubuntu | |
##Actualizamos el sistema | |
RUN apt-get update | |
##En algunas versiones de Linux es necesario configurar una variable para el TIMEZONE | |
ENV TZ=Europe/Madrid | |
##Luego creamos un fichero llamado /etc/timezone para configurar | |
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone | |
##Instalamos NGINX | |
RUN apt-get install -y nginx | |
##Creamos un fichero index.html en el directorio por defecto de nginx | |
RUN echo 'Ejemplo de POD con KUBERNETES y YAML' > /var/www/html/index.html | |
##Arrancamos NGINX a través de ENTRYPOINT para que no pueda ser modificado en la creación del contenedor | |
ENTRYPOINT ["/usr/sbin/nginx", "-g", "daemon off;"] | |
##Exponemos el Puerto 80 | |
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: multi | |
spec: | |
containers: | |
- name: web | |
image: nginx | |
ports: | |
- containerPort: 80 | |
- name: frontal | |
image: alpine | |
command: ["watch", "-n5", "ping", "localhost"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: nginx | |
labels: | |
zone: prod | |
version: v1 | |
spec: | |
containers: | |
- name: nginx | |
image: roxsross12/nginx:v1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat | |
labels: | |
app: tomcat | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat | |
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: never | |
labels: | |
app: app1 | |
spec: | |
containers: | |
- name: never | |
image: busybox | |
command: ['sh', '-c', 'echo Ejemplo de pod fallado && exit 1'] | |
restartPolicy: Never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: on-failure | |
labels: | |
app: app1 | |
spec: | |
containers: | |
- name: on-failure | |
image: busybox | |
command: ['sh', '-c', 'echo Ejemplo de pod fallado && exit 1'] | |
restartPolicy: OnFailure |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#labels | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat | |
labels: | |
estado: "desarrollo" | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#labels | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat1 | |
labels: | |
estado: "desarrollo" | |
responsable: "juan" | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#labels | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat2 | |
labels: | |
estado: "testing" | |
responsable: "pedro" | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#labels | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat3 | |
labels: | |
estado: "produccion" | |
responsable: "pedro" | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#annotations | |
apiVersion: v1 | |
kind: Pod | |
metadata: | |
name: tomcat4 | |
labels: | |
estado: "produccion" | |
responsable: "pedro" | |
annotations: | |
doc: "Se debe compilar con gcc" | |
adjunto: "ejemplo de anotacion" | |
spec: | |
containers: | |
- name: tomcat | |
image: tomcat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment