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.
With the Ansible Kubernetes module, you get a quick way to effectively work with Kubernetes objects within the cluster on remote hosts. Now, you can automate containerized application management with the Ansible Kubernetes module.
To manage the lifecycle of your application on Kubernetes using Ansible, you can use the Kubernetes Collection for Ansible. This collection of Ansible modules allows a developer to either leverage their existing Kubernetes resource files written in YAML or express the lifecycle management in native Ansible.
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 }}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With