yaml文件实例:nginx+ingress

[root@lab3 nginx]# cat nginx-test.yaml 
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
  name: http-test-dm2
spec:
  replicas: 1
  template:
    metadata:
      labels:
        name: http-test-dm2
    spec:
      containers:
      - name: http-test-con
        image: nginx:alpine
        imagePullPolicy: Never      
        ports:
        - containerPort: 80
---
apiVersion: v1
kind: Service
metadata:
  name: http-nginx-ser
spec:
  type: NodePort
  ports: 
  - port: 80
    nodePort: 31000
    targetPort: 80
  selector:
    name: http-test-dm2
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: grafana
spec:
  rules:
  - host: www.nginx2.com      
    http:
      paths:
      - path: /
        backend:
          serviceName: http-nginx-ser
          servicePort: 80

 

posted @ 2019-03-04 13:15  effortsing  阅读(1170)  评论(0编辑  收藏  举报