# First you need to create a secret using the CLI, with: 
# kubectl create secret generic --from-literal access-key=<YOUR_SYSDIG_API_TOKEN> -n custom-metrics sysdig-api

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: custom-metrics-apiserver
  namespace: custom-metrics
  labels:
    app: custom-metrics-apiserver
spec:
  replicas: 1
  selector:
    matchLabels:
      app: custom-metrics-apiserver
  template:
    metadata:
      labels:
        app: custom-metrics-apiserver
    spec:
      tolerations:
      - key: beta.kubernetes.io/arch
        value: arm
        effect: NoSchedule
      - key: beta.kubernetes.io/arch
        value: arm64
        effect: NoSchedule
      serviceAccountName: custom-metrics-apiserver
      volumes:
      - name: sysdig-api
        secret:
          secretName: sysdig-api
      containers:
      - name: custom-metrics-server
        image: sysdiglabs/kubernetes-sysdig-metrics-apiserver:v0.2
        imagePullPolicy: Always
        command: ["adapter"]
        args:
        - "--logtostderr=true"
        - "--v=10"
        env:
        - name: SDC_TOKEN
          valueFrom:
            secretKeyRef:
              name: sysdig-api
              key: access-key
        - name: SDC_ENDPOINT
          value: "https://app.sysdigcloud.com/api/"
        - name: CLUSTER_NAME
          value: "YourClusterName"
        ports:
        - containerPort: 443
        securityContext:
          runAsUser: 0
