The following plugin provides functionality available through Pipeline-compatible steps. Read more about how to integrate steps into your Pipeline in the Steps section of the Pipeline Syntax page.
For a list of other such plugins, see the Pipeline Steps Reference page.
kubernetesDeploy
: Deploy to Kubernetesconfigs : String
(optional)
The path patterns for the Kubernetes configurations you want to deploy, in the form of Ant glob syntax.
credentialsType : String
(optional)
Choose how to get the kubeconfig file to authenticate with the Kubernetes cluster management endpoint.
3 options are supported:
~/.kube/config
file through an SSH connection to the master node.See also: Configure kubectl
deleteResource : boolean
(optional)
Whether to delete the resource, if it is true, delete all resources in the config file.
dockerCredentials
(optional)
url : String
https://index.docker.io/v1/
).
credentialsId : String
enableConfigSubstitution : boolean
(optional)
Substitute variables (in the form $VARIABLE
or ${VARIABLE}
) in the configuration with values from Jenkins environment variables.
This allows you to use dynamic values produced during the build in your Kubernetes configurations, e.g., a dynamically generated Docker image tag which will be used later in the deployment.
kubeConfig
(optional)
path : String
(optional)
kubeconfig
file path relative to the current Jenkins workspace.
kubeconfigId : String
(optional)
secretName : String
(optional)
imagePullSecrets
entry. Environment variable substitution are supported for the name input, so you can use available environment variables to construct the name dynamically, e.g., some-secret-$BUILD_NUMBER
. The name should be in the pattern [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*
, i.e., dot (.) concatenated sequences of hyphen (-) separated alphanumeric words. (See Kubernetes Names)
If left blank, the plugin will generate a name based on the build name.
The secret name will be exposed with the environment variable $KUBERNETES_SECRET_NAME
. You can use this in your Kubernetes configuration to reference the updated secret when the "Enable Variable Substitution in Config" option is enabled.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: some.private.registry.domain/nginx
ports:
- containerPort: 80
imagePullSecrets:
- name: $KUBERNETES_SECRET_NAME
Note that once the secret is created, it will only be updated by the plugin. You have to manually delete it when it is not used anymore. If this is a problem, you may use fixed name so every time the job runs, the secret gets updated and no new secret is created.
secretNamespace : String
(optional)
ssh
(optional)
sshCredentialsId : String
(optional)
sshServer : String
(optional)
<host>[:<port>]
) of the Kubernetes master node. If port is omitted, the default SSH port 22 will be used.
textCredentials
(optional)
certificateAuthorityData : String
(optional)
clusters.cluster.certificate-authority-data
value in the kubeconfig
file.
clientCertificateData : String
(optional)
users.user.client-certificate-data
value in the kubeconfig
file.
clientKeyData : String
(optional)
users.user.client-key-data
value in the kubeconfig
file.
serverUrl : String
(optional)
clusters.cluster.server
address in the kubeconfig
. Generally, it should start with https://
.
step([$class: 'KubernetesDeploy'])
: Deploy to Kubernetescontext
configs : String
(optional)
The path patterns for the Kubernetes configurations you want to deploy, in the form of Ant glob syntax.
credentialsType : String
(optional)
Choose how to get the kubeconfig file to authenticate with the Kubernetes cluster management endpoint.
3 options are supported:
~/.kube/config
file through an SSH connection to the master node.See also: Configure kubectl
deleteResource : boolean
(optional)
Whether to delete the resource, if it is true, delete all resources in the config file.
dockerCredentials
(optional)
url : String
https://index.docker.io/v1/
).
credentialsId : String
enableConfigSubstitution : boolean
(optional)
Substitute variables (in the form $VARIABLE
or ${VARIABLE}
) in the configuration with values from Jenkins environment variables.
This allows you to use dynamic values produced during the build in your Kubernetes configurations, e.g., a dynamically generated Docker image tag which will be used later in the deployment.
kubeConfig
(optional)
path : String
(optional)
kubeconfig
file path relative to the current Jenkins workspace.
kubeconfigId : String
(optional)
secretName : String
(optional)
imagePullSecrets
entry. Environment variable substitution are supported for the name input, so you can use available environment variables to construct the name dynamically, e.g., some-secret-$BUILD_NUMBER
. The name should be in the pattern [a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*
, i.e., dot (.) concatenated sequences of hyphen (-) separated alphanumeric words. (See Kubernetes Names)
If left blank, the plugin will generate a name based on the build name.
The secret name will be exposed with the environment variable $KUBERNETES_SECRET_NAME
. You can use this in your Kubernetes configuration to reference the updated secret when the "Enable Variable Substitution in Config" option is enabled.
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: nginx
spec:
replicas: 1
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: some.private.registry.domain/nginx
ports:
- containerPort: 80
imagePullSecrets:
- name: $KUBERNETES_SECRET_NAME
Note that once the secret is created, it will only be updated by the plugin. You have to manually delete it when it is not used anymore. If this is a problem, you may use fixed name so every time the job runs, the secret gets updated and no new secret is created.
secretNamespace : String
(optional)
ssh
(optional)
sshCredentialsId : String
(optional)
sshServer : String
(optional)
<host>[:<port>]
) of the Kubernetes master node. If port is omitted, the default SSH port 22 will be used.
textCredentials
(optional)
certificateAuthorityData : String
(optional)
clusters.cluster.certificate-authority-data
value in the kubeconfig
file.
clientCertificateData : String
(optional)
users.user.client-certificate-data
value in the kubeconfig
file.
clientKeyData : String
(optional)
users.user.client-key-data
value in the kubeconfig
file.
serverUrl : String
(optional)
clusters.cluster.server
address in the kubeconfig
. Generally, it should start with https://
.
Please submit your feedback about this page through this quick form.
Alternatively, if you don't wish to complete the quick form, you can simply indicate if you found this page helpful?
See existing feedback here.