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
(optional)
The path patterns for the Kubernetes configurations you want to deploy, in the form of Ant glob syntax.
String
credentialsType
(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
String
deleteResource
(optional)
Whether to delete the resource, if it is true, delete all resources in the config file.
boolean
dockerCredentials
(optional)
url
https://index.docker.io/v1/
).
String
credentialsId
String
enableConfigSubstitution
(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.
boolean
kubeConfig
(optional)
path
(optional)
kubeconfig
file path relative to the current Jenkins workspace.
String
kubeconfigId
(optional)
String
secretName
(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.
String
secretNamespace
(optional)
String
ssh
(optional)
sshCredentialsId
(optional)
String
sshServer
(optional)
<host>[:<port>]
) of the Kubernetes master node. If port is omitted, the default SSH port 22 will be used.
String
textCredentials
(optional)
certificateAuthorityData
(optional)
clusters.cluster.certificate-authority-data
value in the kubeconfig
file.
String
clientCertificateData
(optional)
users.user.client-certificate-data
value in the kubeconfig
file.
String
clientKeyData
(optional)
users.user.client-key-data
value in the kubeconfig
file.
String
serverUrl
(optional)
clusters.cluster.server
address in the kubeconfig
. Generally, it should start with https://
.
String
step([$class: 'KubernetesDeploy'])
: Deploy to Kubernetescontext
configs
(optional)
The path patterns for the Kubernetes configurations you want to deploy, in the form of Ant glob syntax.
String
credentialsType
(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
String
deleteResource
(optional)
Whether to delete the resource, if it is true, delete all resources in the config file.
boolean
dockerCredentials
(optional)
url
https://index.docker.io/v1/
).
String
credentialsId
String
enableConfigSubstitution
(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.
boolean
kubeConfig
(optional)
path
(optional)
kubeconfig
file path relative to the current Jenkins workspace.
String
kubeconfigId
(optional)
String
secretName
(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.
String
secretNamespace
(optional)
String
ssh
(optional)
sshCredentialsId
(optional)
String
sshServer
(optional)
<host>[:<port>]
) of the Kubernetes master node. If port is omitted, the default SSH port 22 will be used.
String
textCredentials
(optional)
certificateAuthorityData
(optional)
clusters.cluster.certificate-authority-data
value in the kubeconfig
file.
String
clientCertificateData
(optional)
users.user.client-certificate-data
value in the kubeconfig
file.
String
clientKeyData
(optional)
users.user.client-key-data
value in the kubeconfig
file.
String
serverUrl
(optional)
clusters.cluster.server
address in the kubeconfig
. Generally, it should start with https://
.
String
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.