Last active
December 15, 2025 23:41
-
-
Save roxsross/7ce3e3265cbc1efda7d31ade524871d2 to your computer and use it in GitHub Desktop.
Deployments
This file contains hidden or 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: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: app1 | |
| labels: | |
| app: app1 | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: | |
| app: app1 | |
| template: | |
| metadata: | |
| labels: | |
| app: app1 | |
| spec: | |
| containers: | |
| - name: nginx | |
| image: nginx | |
| ports: | |
| - containerPort: 80 | |
| command: ["/bin/sh", "-c"] | |
| args: | |
| - | | |
| echo '¡Soy la primera, la aplicación numero 1!' > /usr/share/nginx/html/index.html && \ | |
| nginx -g 'daemon off;' | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: servicio-app1 | |
| spec: | |
| selector: | |
| app: app1 | |
| ports: | |
| - port: 8080 | |
| targetPort: 80 | |
| type: ClusterIP |
This file contains hidden or 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: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: app2 | |
| labels: | |
| app: app2 | |
| spec: | |
| replicas: 3 | |
| selector: | |
| matchLabels: | |
| app: app2 | |
| template: | |
| metadata: | |
| labels: | |
| app: app2 | |
| spec: | |
| containers: | |
| - name: nginx | |
| image: nginx | |
| ports: | |
| - containerPort: 80 | |
| command: ["/bin/sh", "-c"] | |
| args: | |
| - | | |
| echo '¡Soy la segunda, la aplicación numero 2!' > /usr/share/nginx/html/index.html && \ | |
| nginx -g 'daemon off;' | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: servicio-app2 | |
| spec: | |
| selector: | |
| app: app2 | |
| ports: | |
| - port: 8080 | |
| targetPort: 80 | |
| type: ClusterIP |
This file contains hidden or 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: networking.k8s.io/v1 | |
| kind: Ingress | |
| metadata: | |
| name: host-ingress | |
| annotations: | |
| nginx.ingress.kubernetes.io/rewrite-target: / | |
| spec: | |
| ingressClassName: nginx | |
| rules: | |
| - host: app1.127.0.0.1.nip.io | |
| http: | |
| paths: | |
| - path: / | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: servicio-app1 | |
| port: | |
| number: 8080 | |
| - host: app2.127.0.0.1.nip.io | |
| http: | |
| paths: | |
| - path: / | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: servicio-app2 | |
| port: | |
| number: 8080 |
This file contains hidden or 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: networking.k8s.io/v1 | |
| kind: Ingress | |
| metadata: | |
| name: minimal-ingress | |
| annotations: | |
| nginx.ingress.kubernetes.io/rewrite-target: / | |
| spec: | |
| ingressClassName: nginx | |
| rules: | |
| - http: | |
| paths: | |
| - path: /app1 | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: servicio-app1 | |
| port: | |
| number: 8080 | |
| - path: /app2 | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: servicio-app2 | |
| port: | |
| number: 8080 |
Comments are disabled for this gist.