Using Ansible module k8s , how can we patch a deployment with an additional container.
I would like to understand how can we achieve a patch to the below deployment using ansible modules:
Initial dpeloyment.yaml:
apiVersion: apps/v1
kind: Deployment
metadata:
name: patch-demo
spec:
replicas: 2
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: patch-demo-ctr
image: nginx
tolerations:
- effect: NoSchedule
key: dedicated
value: test-team
Patch with:
spec:
template:
spec:
containers:
- name: patch-demo-ctr-2
image: redis
How can I perform this action using an ansible module?
kubectl patch deployment patch-demo --patch "$(cat patch-file.yaml)"