1
votes

I have following code in Jenkinsfile , and have installed kubernetes plugin installed.

steps {
    script {
        withKubeConfig([
            credentialsId: 'jenkins',
            caCertificate: '',
            serverUrl: '<URL>',
            contextName: '',
            clusterName: '',
            namespace: ''
        ]) {
            sh("kubectl get ns development || kubectl create ns development")
        }
    }
}

I am getting the following error

java.lang.NoSuchMethodError: No such DSL method 'withKubeConfig' found among steps [approveReceivedEvent, approveRequestedEvent, archive, bat, build, catchError, checkout, container, containerLog, createEvent, deleteDir, dir, dockerFingerprintFrom, dockerFingerprintRun, echo, emailext, emailextrecipients, envVarsForTool, error, fileExists, findBuildScans, getContext, git, input, isUnix, jiraComment, jiraIssueSelector, jiraSearch, junit, kubernetesApply, kubernetesDeploy, library, libraryResource, load, lock, mail, milestone, node, parallel, podTemplate, powershell, properties, publishChecks, publishHTML, pwd, pwsh, readFile, readTrusted, resolveScm, retry, script, setGitHubPullRequestStatus, sh, slackSend, slackUploadFile, slackUserIdFromEmail, slackUserIdsFromCommitters, sleep, stage, stash, step, svn, timeout, timestamps, tm, tool, unarchive, unstable, unstash, validateDeclarativePipeline, waitUntil, warnError, withContext, withCredentials, withDockerContainer, withDockerRegistry, withDockerServer, withEnv, withGradle, wrap, writeFile, ws] or symbols [GenericTrigger, Number, Open, all, allBranchesSame, allOf, allowRunOnStatus, always, ant, antFromApache, antOutcome, antPath, antTarget, any, anyOf, apiToken, architecture,

Any Idea? Please help

1
Do you have the kubernetes-cli plugin installed? If so screen shot it and update your postChris Maggiulli

1 Answers

1
votes

This step is part of the kubernetes-cli-plugin rather than the kubernete-plugin

https://github.com/jenkinsci/kubernetes-cli-plugin/blob/master/README.md