I am learning to automate kubernetes cluster using Ansible
I am able to create the cluster and run kubectl apply -f service
and kubectl apply -f deployment
through ansible task and they work fine, but when I run kubectl port-forward service/simple-api 3000:3000 &
in the output, it shows command executed successfully but when I check for running services on my target host, It didn't start. Although when I run the same command directly on the host terminal it works properly.
You will need a nohup
in front of that command in order for it to survive the ssh disconnect that happens at the end of the command:
or shell:
task