apiVersion: apps/v1
kind: Deployment
metadata:
  name: test-agent
  labels:
    app: test-agent
spec:
  replicas: 1
  selector:
    matchLabels:
      app: test-agent
  template:
    metadata:
      labels:
        app: test-agent
    spec:
      initContainers:
        - name: kmsagent
          image: registry.cn-hangzhou.aliyuncs.com/{namespace}/{repository}:kmsagent-1.0
          restartPolicy: Always
          env:
            - name: KMS_TOKEN
              value: <token>
            - name: ALIBABA_CLOUD_VPC_ENDPOINT_ENABLED
              value: 'true'
            - name: ALIBABA_CLOUD_STS_REGION
              value: cn-hangzhou
      containers:
        - name: app
          image: registry.cn-hangzhou.aliyuncs.com/{namespace}/{repository}:app-1.0