# one rc deployment, schedule it to the node that has a label "ip" equals to "172.18.8.241"
apiVersion: apps/v1
kind: Deployment
metadata:
name: 241-dvwa
spec:
replicas: 1
selector:
matchLabels:
app: 241-dvwa
template:
metadata:
labels:
app: 241-dvwa
spec:
nodeSelector:
ip: 172.18.8.241
containers:
- name: nginx
image: 172.18.8.210:5000/library/vulnerables/web-dvwa:latest
ports:
- containerPort: 80
---
# expose 80 port server
apiVersion: v1
kind: Service
metadata:
name: dvwa-service-241
spec:
selector:
app: 241-dvwa
ports:
- protocol: TCP
port: 80
targetPort: 80
type: ClusterIP
YAML示例:创建单幅本nginx容器到指定节点及其service
发布时间 2024-01-12 10:49:02作者: shininglight