How to setup kubectl within jenkins
You need to install kubectl on EC2 instance(follow this link: https://kubernetes.io/docs/tasks/tools/install-kubectl/).
Once it is installed you have to export the path:https://opensource.com/article/17/6/set-path-linux
or you use full path like : sh "~/place/where/kubectl/installed/kubectl apply -f platform_api_deployment.yml"