In my jenkins pipeline, I've configured like that one.
stage('Deploying into k8s'){
steps{
sh 'kubectl set image deployment/my-api my-api=ppshein/myapi:${BUILD_NUMBER} -n my-ns --record'
}
}
and when I've run Jenkins pipeline, I've encountered following error message:
error: the server doesn't have a resource type "deployment"
But when I ssh to my EC2 instance and run same command, it was working successfully.
Please let me know I missed something to configure in Jenkins or somehow user authentication in my server?
User Jenkins' home directory must have .kube/config
,for example
/var/lib/jenkins/.kube/config