在kubernetes集群中运行nginx
https://blog.51cto.com/ylw6006/2071845
k8s nginx web 测试
cat >nginx-web.yaml <<EOF
apiVersion: v1
kind: ReplicationController
metadata:
name: nginx-web
spec:
replicas: 1
selector:
app: nginx-web
template:
metadata:
labels:
app: nginx-web
spec:
containers:
- name: nginx-web
image: docker.io/nginx
ports:
- containerPort: 80
volumeMounts:
- name: confd
mountPath: /usr/local/nginx/conf/conf.d
volumes:
- name: confd
hostPath:
path: /data/nginx/conf.d
---
apiVersion: v1
kind: Service
metadata:
name: nginx-web
spec:
type: NodePort
ports:
- port: 80
targetPort: 80
nodePort: 30080
selector:
app: nginx-web
EOF
kubectl apply -f nginx-web.yaml
文档更新时间: 2020-07-31 01:35 作者:月影鹏鹏