9

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 modifying is the JMeter one and the additional YAML I'm adding is as below:

- name: InfluxDB Storage Secret
  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.

β.εηοιτ.βε
  • 33,893
  • 13
  • 69
  • 83
David C
  • 501
  • 1
  • 4
  • 16
  • 1
    Could You provide us output from jmester/tasks/main? What is the error that You encountered? – Jakub Dec 06 '19 at 11:09
  • Is there a way I can show the output while it's running in a pod in kubernetes? I don't have a dev environment setup for Ansible yet (I keep getting further and further away from what I set out to do!) and might have to shelve my desired changes. – David C Dec 06 '19 at 12:07

1 Answers1

12

Here is my example, that works for me, hope it help.

  - name: CREATE MONGOSECRETS SECRET
    kubernetes.core.k8s:
      state: present
      definition: 
        apiVersion: v1
        kind: Secret
        type: Opaque             
        metadata:
          name: "{{ secret_name }}"
          namespace: "{{ project_name | lower }}"     
        data:
          config_data.json: "{{ lookup('template', mongo_conn_templates_path + '/config_data.json' ) | tojson | b64encode }}"
Vasantha Ganesh
  • 4,570
  • 3
  • 25
  • 33
Samush
  • 121
  • 1
  • 4