How can I create a Kubernetes Secret with Ansible?

12/5/2019

I'm using an Ansible Jmeter Operator to do distributed load testing and am having trouble with creating a kubernetes Secret. The operator I'm modified is https://github.com/kubernauts/jmeter-operator and the additional yaml I'm adding is as follows:

  k8s:
    apiVersion: v1
    kind: Secret
    type: Opaque
    metadata:
      name: azure-storage-account-infxluxdb-secret
      namespace: '{{ meta.namespace }}'
    stringData:
      azurestorageaccountname: 'xxxxxxx'
      azurestorageaccountkey: 'xxxxxxxxxxx'

Is there anything wrong with the yaml definition? I'm modifying the roles/jmeter/tasks/main.yaml of the role to add it into my specific namespace.

If there is any more information required please say, this is my first dive into k8s!

-- David C
ansible
kubernetes

0 Answers