k8s_serving.yaml_template 1.3 KB
Newer Older
W
wangjiawei04 已提交
1 2 3 4 5 6 7 8 9
apiVersion: v1
kind: Service
metadata:
  labels:
    app: << APP_NAME >>
  name: << APP_NAME >>
spec:
  ports:
  - port: << PORT >> 
10
    name: http
W
wangjiawei04 已提交
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
    protocol: TCP
    targetPort: << PORT >>
  selector:
    app: << APP_NAME >>
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: << APP_NAME >>
  name: << APP_NAME >>
spec:
  replicas: 1
  selector:
    matchLabels:
      app: << APP_NAME >>
  strategy: {}
  template:
    metadata:
      creationTimestamp: null
      labels:
        app: << APP_NAME >>
    spec:
      containers:
      - image: << IMAGE_NAME >>
        name: << APP_NAME >>
        ports:
        - containerPort: << PORT >>
        workingDir: << WORKDIR >>
        name: << APP_NAME >>
        command: ['/bin/bash', '-c']
        args: [<< COMMAND >>] 
        env:
          - name: NODE_NAME
            valueFrom:
              fieldRef:
                fieldPath: spec.nodeName
          - name: POD_NAME
            valueFrom:
              fieldRef:
                fieldPath: metadata.name
          - name: POD_NAMESPACE
            valueFrom:
              fieldRef:
                fieldPath: metadata.namespace
          - name: POD_IP
            valueFrom:
              fieldRef:
                fieldPath: status.podIP
        resources: {}