首页 > 其他 > 详细

yaml文件示例

时间:2017-12-13 16:41:45      阅读:144      评论:0      收藏:0      [点我收藏+]

标签:yaml文件示例

示例一: game-test.yaml


apiVersion: extensions/v1beta1

kind: Deployment

metadata:

  namespace: uat

  name: game-test

  labels:

    app: game-test

spec:

  replicas: 1

  selector:

    matchLabels:

      app: game-test

  template:

    metadata:

      labels:

        app: game-test

    spec:

      containers:

      - name: game-test

        image: 192.168.1.5:5000/test/game-test:v1

        resources:

          limits:

            cpu: 1000m

            memory: 3000Mi

          requests:

            cpu: 500m

            memory: 1024Mi

        volumeMounts:

        - name: logs

          mountPath: /data/service/game-test/project/logs

        ports:

        - containerPort: 3008

        readinessProbe:

          tcpSocket:

            port: 3008

          initialDelaySeconds: 15

          periodSeconds: 15

        livenessProbe:

          tcpSocket:

            port: 3008

          initialDelaySeconds: 20

          periodSeconds: 20

      volumes:

      - name: logs

        hostPath:

          path: /tmp/logs



game-test-svc.yaml

apiVersion: v1

kind: Service

metadata:

  namespace: uat

  name: game-test

  labels:

    app: game-test

spec:

  selector:

    app: game-test

  ports:

  - port: 3008

    targetPort: 3008


示例二:

 web.yaml 

apiVersion: extensions/v1beta1

kind: Deployment

metadata:

  namespace: uat

  name: web

  labels:

    app: web

spec:

  replicas: 1

  selector:

    matchLabels:

      app: web

  template:

    metadata:

      labels:

        app: web

    spec:

      containers:

      - name: web

        image: 192.168.1.5:5000/test/web:v1

        resources:

          limits:

            cpu: 1000m

            memory: 3000Mi

          requests:

            cpu: 500m

            memory: 1024Mi

        volumeMounts:

        - name: logs

          mountPath: /usr/local/tomcat/logs/

        ports:

        - containerPort: 8080

        readinessProbe:

          tcpSocket:

            port: 8080

          initialDelaySeconds: 40

          periodSeconds: 15

        livenessProbe:

          tcpSocket:

            port: 8080

          initialDelaySeconds: 40

          periodSeconds: 20

      volumes:

      - name: logs

        hostPath:

          path: /tmp/web/logs

  

  

  web-svc.yaml 

apiVersion: v1

kind: Service

metadata:

  namespace: uat

  name: web

  labels:

    app: web

spec:

  selector:

    app: web

  ports:

  - port: 8080

    targetPort: 8080

---

apiVersion: extensions/v1beta1

kind: Ingress

metadata:

  namespace: uat

  name: web

spec:

  rules:

  - host: testhost

    http:

      paths:

      - path: /web

        backend:

          serviceName: web

          servicePort: 8080   

  





yaml文件示例

标签:yaml文件示例

原文:http://blog.51cto.com/superleedo/2050226

(0)
(0)
   
举报
评论 一句话评论(0
0条  
登录后才能评论!
© 2014 bubuko.com 版权所有 鲁ICP备09046678号-4
打开技术之扣,分享程序人生!
             

鲁公网安备 37021202000002号