apiVersion: v1 kind: Namespace metadata: name: whoami --- kind: DaemonSet apiVersion: apps/v1 metadata: name: whoami-public namespace: whoami spec: selector: matchLabels: app: whoami-public template: metadata: labels: app: whoami-public spec: containers: - name: whoami-public image: traefik/whoami ports: - containerPort: 80 protocol: TCP env: - name: WHOAMI_NAME value: public resources: limits: cpu: "1000m" memory: "500Mi" requests: cpu: "10m" memory: "10Mi" --- kind: DaemonSet apiVersion: apps/v1 metadata: name: whoami-private namespace: whoami spec: selector: matchLabels: app: whoami-private template: metadata: labels: app: whoami-private spec: containers: - name: whoami-private image: traefik/whoami ports: - containerPort: 80 protocol: TCP env: - name: WHOAMI_NAME value: private resources: limits: cpu: "1000m" memory: "500Mi" requests: cpu: "10m" memory: "10Mi" --- kind: Service apiVersion: v1 metadata: name: whoami-public namespace: whoami spec: type: ClusterIP ports: - port: 80 targetPort: 80 selector: app: whoami-public --- kind: Service apiVersion: v1 metadata: name: whoami-private namespace: whoami spec: type: ClusterIP ports: - port: 80 targetPort: 80 selector: app: whoami-private --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: traefik.ingress.kubernetes.io/router.entrypoints: web,websecure labels: app: whoami-public name: whoami-public namespace: whoami spec: ingressClassName: traefik rules: - host: whoami.public.cluster http: paths: - backend: service: name: whoami-public port: number: 80 path: / pathType: Prefix --- apiVersion: networking.k8s.io/v1 kind: Ingress metadata: annotations: traefik.ingress.kubernetes.io/router.entrypoints: web-priv,websecure-priv labels: app: whoami-private name: whoami-private namespace: whoami spec: ingressClassName: traefik rules: - host: whoami.private.cluster http: paths: - backend: service: name: whoami-private port: number: 80 path: / pathType: Prefix