码迷,mamicode.com
首页 > 其他好文 > 详细

yaml文件示例

时间:2017-12-13 17:26:31      阅读:277      评论: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
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!