Created
January 7, 2022 22:25
-
-
Save oki/2f02e2dede95d7448c3a18129420245e to your computer and use it in GitHub Desktop.
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
version: "3" | |
services: | |
whoami: | |
image: containous/whoami | |
networks: | |
- default | |
- traefik-public | |
deploy: | |
replicas: 1 | |
labels: | |
- traefik.enable=true | |
- traefik.port=80 | |
- traefik.tags=traefik-public | |
- traefik.frontend.rule=Host:whoami.d.md6.org,whoami.f.md6.org | |
- traefik.docker.network=traefik-public | |
# Traefik service that listens to HTTP | |
- traefik.redirectorservice.frontend.entryPoints=http | |
- traefik.redirectorservice.frontend.redirect.entryPoint=https | |
# Traefik service that listens to HTTPS | |
- traefik.webservice.frontend.entryPoints=https | |
networks: | |
traefik-public: | |
external: true | |
# docker network create nginx --scope swarm -d overlay | |
# docker stack deploy -c docker-compose-swarm.yml hello | |
# docker service logs -tf hello_hello |
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: apps/v1 | |
kind: Deployment | |
metadata: | |
name: app-whoami | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: app-whoami | |
template: | |
metadata: | |
labels: | |
app: app-whoami | |
spec: | |
containers: | |
- name: app | |
image: containous/whoami | |
ports: | |
- containerPort: 80 | |
livenessProbe: | |
httpGet: | |
path: /healthz | |
port: 80 | |
initialDelaySeconds: 3 | |
periodSeconds: 5 | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: app-whoami | |
name: app-whoami | |
annotations: | |
spec: | |
selector: | |
app: app-whoami | |
type: ClusterIP | |
ports: | |
- port: 80 | |
targetPort: 80 | |
name: app | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: whoami | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
nginx.ingress.kubernetes.io/ssl-redirect: "false" | |
spec: | |
rules: | |
- host: whoami.dev.k8s.tachobus.pl | |
http: | |
paths: | |
- pathType: Prefix | |
path: "/" | |
backend: | |
service: | |
name: app-whoami | |
port: | |
number: 80 | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: whoami-secure | |
annotations: | |
kubernetes.io/ingress.class: "nginx" | |
nginx.ingress.kubernetes.io/ssl-redirect: "false" | |
nginx.ingress.kubernetes.io/auth-type: basic | |
nginx.ingress.kubernetes.io/auth-secret: basic-auth | |
nginx.ingress.kubernetes.io/auth-realm: 'Authentication Required - whoami' | |
spec: | |
rules: | |
- host: whoami.dev.k8s.tachobus.pl | |
http: | |
paths: | |
- pathType: Prefix | |
path: "/secure" | |
backend: | |
service: | |
name: app-whoami | |
port: | |
number: 80 | |
# kubectl apply -f kubernetes.yml |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment