简体   繁体   中英

java.lang.NoSuchMethodError: No such DSL method 'withKubeConfig' found among steps [approveReceivedEvent,

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM