kubectl - Execute tasks in pods running on Kubernetes.
New in version 2.5.
Synopsis
- Use the kubectl exec command to run tasks in, or put/fetch files to, pods running on the Kubernetes container platform.
Requirements
The below requirements are needed on the local master node that executes this connection.
- kubectl (go binary)
Parameters
Parameter | Choices/Defaults | Configuration | Comments |
---|---|---|---|
kubectl_cert_file | Default: | env:K8S_AUTH_CERT_FILE var: ansible_kubectl_cert_file | Path to a certificate used to authenticate with the API. |
kubectl_container | Default: | env:K8S_AUTH_CONTAINER var: ansible_kubectl_container | Container name. Required when a pod contains more than one container. |
kubectl_context | Default: | env:k8S_AUTH_CONTEXT var: ansible_kubectl_context | The name of a context found in the K8s config file. |
kubectl_extra_args | Default: | env:K8S_AUTH_EXTRA_ARGS var: ansible_kubectl_extra_args | Extra arguments to pass to the kubectl command line. |
kubectl_host | Default: | env:K8S_AUTH_HOST env:K8S_AUTH_SERVER var: ansible_kubectl_host var: ansible_kubectl_server | URL for accessing the API. |
kubectl_key_file | Default: | env:K8S_AUTH_KEY_FILE var: ansible_kubectl_key_file | Path to a key file used to authenticate with the API. |
kubectl_kubeconfig | Default: | env:K8S_AUTH_KUBECONFIG var: ansible_kubectl_kubeconfig var: ansible_kubectl_config | Path to a kubectl config file. Defaults to ~/.kube/conig
|
kubectl_namespace | Default: | env:K8S_AUTH_NAMESPACE var: ansible_kubectl_namespace | The namespace of the pod |
kubectl_password | Default: | env:K8S_AUTH_PASSWORD var: ansible_kubectl_password | Provide a password for authenticating with the API. |
kubectl_pod | Default: | env:K8S_AUTH_POD var: ansible_kubectl_pod | Pod name. Required when the host name does not match pod name. |
kubectl_ssl_ca_cert | Default: | env:K8S_AUTH_SSL_CA_CERT var: ansible_kubectl_cert_file | Path to a CA certificate used to authenticate with the API. |
kubectl_token | env:K8S_AUTH_TOKEN env:K8S_AUTH_API_KEY var: ansible_kubectl_token var: ansible_kubectl_api_key | API authentication bearer token. | |
kubectl_username | Default: | env:K8S_AUTH_USERNAME var: ansible_kubectl_username | Provide a username for authenticating with the API. |
kubectl_verify_ssl | Default: | env:K8s_AUTH_VERIFY_SSL var: ansible_kubectl_verify_ssl | Whether or not to verify the API server's SSL certificate. Defaults to true. |
Status
Author
- xuxinkun
Hint
If you notice any issues in this documentation you can edit this document to improve it.
© 2012–2018 Michael DeHaan
© 2018–2019 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/2.5/plugins/connection/kubectl.html