kubernetes部署nginx
1、nginx_deployment文件[root@k8s-master ~]# cat nginx.yamlapiVersion: apps/v1kind: Deploymentmetadata:labels:app: nginxname: nginxspec:replicas: 1selector:matchLabels:a...
·
1、nginx_deployment文件
[root@k8s-master ~]# cat nginx.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: nginx
name: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx
ports:
- containerPort: 80
2、nginx_svc文件
[root@k8s-master ~]# cat nginx_svc.yaml
apiVersion: v1
kind: Service
metadata:
labels:
app: nginx
name: nginx
spec:
ports:
- port: 8080
protocol: TCP
targetPort: 80
selector:
app: nginx
type: NodePort
3、nginx_ingress文件
[root@k8s-master ~]# cat nginx_ingress.yaml
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: nginx
namespace: default
spec:
rules:
- host: nginx.qq.com
http:
paths:
- backend:
serviceName: nginx
servicePort: 80
path: /
更多推荐
已为社区贡献45条内容
所有评论(0)