有时候会用到避免重写,重找麻烦
1.busybox
apiVersion: apps/v1 kind: Deployment metadata: name: client spec: replicas: 1 selector: matchLabels: app: client template: metadata: labels: app: client spec: containers: - name: busybox image: busybox:1.28.4 imagePullPolicy: IfNotPresent command: ["/bin/sh","-c","sleep 3600"]
command: ["/bin/sh","-c","echo 'hello httpd' > /var/www/index/html;httpd -f -p 8080 -h /var/www"] #开启httpd
2. nginx
apiVersion: apps/v1 kind: Deployment metadata: name: nginx-test labels: app: nginx-test spec: replicas: 1 selector: matchLabels: app: nginx-test template: metadata: labels: app: nginx-test spec: containers: - name: nginx image: nginx imagePullPolicy: IfNotPresent ports: - containerPort: 80 --- apiVersion: v1 kind: Service metadata: name: nginx-test labels: app: nginx-test spec: ports: - name: nginx-test port: 80 targetPort: 80 selector: app: nginx-test