Last active
March 7, 2023 19:34
-
-
Save clouditlab/ed8663ad5763dea43b83a503a9f4e5fa to your computer and use it in GitHub Desktop.
How to Expose Your Applications for External Access Using Traefik as Ingress Controller
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: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: itlab-goodbye | |
| data: | |
| nginx.conf: ' | |
| events { | |
| } | |
| http { | |
| server { | |
| listen 80; | |
| location / { | |
| return 200 "Bye IT Lab solution readers!"; | |
| } | |
| } | |
| } | |
| ' | |
| --- | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: itlab-goodbye | |
| spec: | |
| selector: | |
| matchLabels: | |
| owner: cloud-itlab | |
| app: itlab-goodbye | |
| replicas: 2 | |
| template: | |
| metadata: | |
| labels: | |
| owner: cloud-itlab | |
| app: itlab-goodbye | |
| spec: | |
| containers: | |
| - name: itlab-goodbye | |
| image: nginx:latest | |
| ports: | |
| - containerPort: 80 | |
| volumeMounts: | |
| - name: itlab-goodbye-vol | |
| mountPath: /etc/nginx/ | |
| volumes: | |
| - name: itlab-goodbye-vol | |
| configMap: | |
| name: itlab-goodbye | |
| items: | |
| - key: nginx.conf | |
| path: nginx.conf | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: itlab-goodbye | |
| labels: | |
| app: itlab-goodbye | |
| spec: | |
| ports: | |
| - port: 80 | |
| protocol: TCP | |
| selector: | |
| app: itlab-goodbye |
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: v1 | |
| kind: ConfigMap | |
| metadata: | |
| name: itlab-hello | |
| data: | |
| nginx.conf: ' | |
| events { | |
| } | |
| http { | |
| server { | |
| listen 80; | |
| location / { | |
| return 200 "Hello IT Lab solution readers!"; | |
| } | |
| } | |
| } | |
| ' | |
| --- | |
| apiVersion: apps/v1 | |
| kind: Deployment | |
| metadata: | |
| name: itlab-hello | |
| spec: | |
| selector: | |
| matchLabels: | |
| owner: cloud-itlab | |
| app: itlab-hello | |
| replicas: 2 | |
| template: | |
| metadata: | |
| labels: | |
| owner: cloud-itlab | |
| app: itlab-hello | |
| spec: | |
| containers: | |
| - name: itlab-hello | |
| image: nginx:latest | |
| ports: | |
| - containerPort: 80 | |
| volumeMounts: | |
| - name: itlab-hello-vol | |
| mountPath: /etc/nginx/ | |
| volumes: | |
| - name: itlab-hello-vol | |
| configMap: | |
| name: itlab-hello | |
| items: | |
| - key: nginx.conf | |
| path: nginx.conf | |
| --- | |
| apiVersion: v1 | |
| kind: Service | |
| metadata: | |
| name: itlab-hello | |
| labels: | |
| app: itlab-hello | |
| spec: | |
| ports: | |
| - port: 80 | |
| protocol: TCP | |
| selector: | |
| app: itlab-hello |
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: itlab-ingress | |
| spec: | |
| rules: | |
| - host: itlab-hello.example.com | |
| http: | |
| paths: | |
| - path: / | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: itlab-hello | |
| port: | |
| number: 80 | |
| - host: itlab-goodbye.example.com | |
| http: | |
| paths: | |
| - path: / | |
| pathType: Prefix | |
| backend: | |
| service: | |
| name: itlab-goodbye | |
| port: | |
| number: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment