Skip to content

Instantly share code, notes, and snippets.

@bhubr
Last active December 9, 2021 10:45
Show Gist options
  • Save bhubr/cc4da0b8b29a98012ee8841827a2c789 to your computer and use it in GitHub Desktop.
Save bhubr/cc4da0b8b29a98012ee8841827a2c789 to your computer and use it in GitHub Desktop.
Kubernetes
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-deployment
labels:
app: nginx
spec:
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
kind: Pod
apiVersion: v1
metadata:
name: testk8s-app
labels:
app: testk8s-app
spec:
containers:
- name: testk8s-app
image: hashicorp/http-echo:0.2.3
args:
- "-text=Hello World! This is a testk8s Kubernetes with kind App"
---
kind: Service
apiVersion: v1
metadata:
name: testk8s-service
spec:
selector:
app: testk8s-app
ports:
# Default port used by the image
- port: 5678
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: testk8s-ingress
spec:
rules:
- http:
paths:
- pathType: Prefix
path: "/testk8s"
backend:
service:
name: testk8s-service
port:
number: 5678
---
apiVersion: v1
kind: Pod
metadata:
name: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment