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   

  














本文转自super李导51CTO博客,原文链接:http://blog.51cto.com/superleedo/2050226 ,如需转载请自行联系原作者



上一篇:快速升级Oracle 11.2.0.2 RAC到11.2.0.3


下一篇:JavaScript基础(六)面向对象