# Headless Service
apiVersion: v1
kind: Service
metadata:
name: my-headless-service
spec:
ports:
- port: 80
name: web
clusterIP: None
selector:
app: my-app
# Ingress
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: my-ingress
spec:
rules:
- host: my.service.com
http:
paths:
- path: /
pathType: Prefix
backend:
service:
name: my-headless-service
port:
number: 80
# StatefulSet
apiVersion: apps/v1
kind: StatefulSet
metadata:
name: my-statefulset
spec:
selector:
matchLabels:
app: my-app
serviceName: "my-headless-service"
replicas: 3
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: my-image
ports:
- containerPort: 80
欢迎光临 黑帽联盟 (https://bbs.cnblackhat.com/) | Powered by Discuz! X2.5 |