Last active
February 10, 2022 19:08
-
-
Save Pheebzer/08c4be068b6da7438545b6c26488cda5 to your computer and use it in GitHub Desktop.
Example k8s application /w ingress
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
kind: Namespace | |
apiVersion: v1 | |
metadata: | |
name: demo-ns | |
labels: | |
name: demo-ns | |
--- | |
kind: Pod | |
apiVersion: v1 | |
metadata: | |
name: dog-backend | |
namespace: demo-ns | |
labels: | |
app: dogs | |
spec: | |
containers: | |
- name: dogs-backend | |
image: hashicorp/http-echo | |
ports: | |
- containerPort: 80 | |
name: http | |
args: | |
- -listen=:80 | |
- -text="Dogs are the best :)" | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: dog-service | |
namespace: demo-ns | |
spec: | |
selector: | |
app: dogs | |
ports: | |
- name: http | |
port: 80 | |
targetPort: 80 | |
type: ClusterIP | |
--- | |
kind: Pod | |
apiVersion: v1 | |
metadata: | |
name: cat-backend | |
namespace: demo-ns | |
labels: | |
app: cats | |
spec: | |
containers: | |
- name: cats-backend | |
image: hashicorp/http-echo | |
ports: | |
- containerPort: 80 | |
name: http | |
args: | |
- -listen=:80 | |
- -text="Cats are the best :)" | |
--- | |
kind: Service | |
apiVersion: v1 | |
metadata: | |
name: cat-service | |
namespace: demo-ns | |
spec: | |
selector: | |
app: cats | |
ports: | |
- name: http | |
port: 80 | |
targetPort: 80 | |
type: ClusterIP | |
--- | |
apiVersion: networking.k8s.io/v1 | |
kind: Ingress | |
metadata: | |
name: demo-ingress | |
namespace: demo-ns | |
annotations: | |
spec: | |
ingressClassName: nginx | |
rules: | |
- host: k8s.turboblaster.xyz | |
http: | |
paths: | |
- path: /dog | |
pathType: Prefix | |
backend: | |
service: | |
name: dog-service | |
port: | |
number: 80 | |
- path: /cat | |
pathType: Prefix | |
backend: | |
service: | |
name: cat-service | |
port: | |
number: 80 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment