I am running a kubernetes cluster using minikube on a Linux machine as part of a Jenkins pipeline job.
Both the Jenkins slave and minikube run on the same machine. The job runs some golang tests that try to access services running inside the kubernetes cluster.
In my pipeline script I am forwarding ports for some pods in this manner:
stage('start kubernetes'){
sh '''
//start cluster here
kubectl port-forward pods/pod_name 9281 &
kubectl port-forward pods/datastore_name 6379 &
'''
}
stage('start tests'){
sh '''
//run tests
'''
}
I also tried
nohup kubectl port-forward pods/pod_name 9281 &
nohup kubectl port-forward pods/datastore_name 6379 &
When I run the job:
ps | grep port-forward
it shows nothing. Am I missing something?