按照课上的案例编写一个 DaemonSet 类型的 apache 集群的资源文件,并给改资源文件编写一个 ClusterIP 类型的服务
答案:
资源文件
kind: DaemonSet
apiVersion: apps/v1
metadata:
name: myapache
spec:
selector:
matchLabels:
myapp: httpd
template:
metadata:
labels:
myapp: httpd
spec:
containers:
- name: webcluster
image: 192.168.1.100:5000/myos:httpd
stdin: false
tty: false
ports:
- protocol: TCP
containerPort: 80
restartPolicy: Always
kind: Service
apiVersion: v1
metadata:
name: apache
spec:
ports:
- protocol: TCP
port: 80
targetPort: 80
selector:
myapp: httpd
type: ClusterIP