apiVersion: v1
kind: Secret
metadata:
# this is the jenkins id.
  name: "a-kubeconfig-file"
  labels:
# so we know what type it is.
    "jenkins.io/credentials-type": "kubeconfig"
  annotations:
# description - can not be a label as spaces are not allowed
    "jenkins.io/credentials-description" : "kubeconfig file credential from Kubernetes"
type: Opaque
stringData:
  kubeconfig: |-
    apiVersion: v1
    clusters:
    - cluster:
        certificate-authority: opt/kubernetes/ssl/ca.crt
        server: https://kubernetes.server.net:8443
      name: kubernetes
    contexts:
    - context:
        cluster: kubernetes
        namespace: core
        user: kubelet
      name: kubelet-to-kubernetes
    current-context: kubelet-to-kubernetes
    kind: Config
    preferences: {}
    users:
    - name: kubelet
      user:
        client-certificate: opt/kubernetes/ssl/server.crt
        client-key: opt/kubernetes/ssl/server.key
