Skip to content

Instantly share code, notes, and snippets.

@alexandrevilain
Created October 17, 2022 15:24
Show Gist options
  • Save alexandrevilain/a991425ca7439318a96a00a4392b118a to your computer and use it in GitHub Desktop.
Save alexandrevilain/a991425ca7439318a96a00a4392b118a to your computer and use it in GitHub Desktop.
apiVersion: v1
kind: Service
metadata:
name: nginx
labels:
app: nginx
spec:
ports:
- port: 80
name: web
selector:
app: nginx
---
apiVersion: v1
kind: Service
metadata:
name: nginx-headless
labels:
app: nginx
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: nginx
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: web
spec:
serviceName: "nginx"
replicas: 3
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: registry.k8s.io/nginx-slim:0.8
ports:
- containerPort: 80
name: web
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment