Podman-使用play kube创建Pod

2023-04-20 00:00:00 创建 专区 订阅 付费 容器

podman 已可以使用yaml来完成定义POD,新的版本里可以支持deployment , pod 工作负载,以及service。

这样来看,无需再安装podman-compose,使用podman 就可以完成创建pod。

1、以下是定义的deployment文件。

workload-envoy.yaml
apiVersion: v1
kind: Service
metadata:
  creationTimestamp: "2021-07-19T05:33:36Z"
  labels:
    app: route
  name: route
spec:
  ports:
  - name: https
    nodePort: 8443
    port: 8443
    targetPort: 0
    protocol: TCP
  - name: http
    nodePort: 8080
    port: 8080
    targetPort: 0
    protocol: TCP
  selector:
    app: route
  type: NodePort
status:
  loadBalancer: {}
---
apiVersion: apps/v1
kind: Deployment
metadata:
  labels:
    app: route
  name: route
spec:
  replicas: 1
  selector:
    matchLabels:
      app: envoy
  template:
    metadata:
      labels:
        app: envoy
    spec:
      containers:
      - args:
          - envoy
          - -c
          - /etc/envoy/envoy.yaml
        command:
        - /docker-entrypoint.sh
        env:
        - name: TZ
          value: Asia/Shanghai
        - name: ENVOY_UID
          value: "0"
        image: docker.io/envoyproxy/envoy:v1.20.0
        name: envoy
        resources: {}
        securityContext:
          allowPrivilegeEscalation: true
          capabilities: {}
          privileged: false
          readOnlyRootFilesystem: false
        stdin: true
        tty: true
        volumeMounts:
        - mountPath: /etc/envoy
          name: vol-data-route-envoy
        ports:
        - containerPort: 443
          protocol: TCP
          hostPort: 443
        - containerPort: 80
          protocol: TCP
          hostPort: 80
        dnsConfig: {}
        restartPolicy: Never
      volumes:
      - hostPath:
          path: /data/route/envoy
        type: Directory
        name: vol-data-route-envoy
    status: {}

相关文章