k8s_info – Describe Kubernetes (K8s) objects¶
New in version 2.7.
Synopsis¶
- Use the OpenShift Python client to perform read operations on K8s objects.
- Access to the full range of K8s APIs.
- Authenticate using either a config file, certificates, password or token.
- Supports check mode.
- This module was called
k8s_facts
before Ansible 2.9. The usage did not change.
Aliases: k8s_facts
Requirements¶
The below requirements are needed on the host that executes this module.
- python >= 2.7
- openshift >= 0.6
- PyYAML >= 3.11
Parameters¶
Notes¶
Note
- The OpenShift Python client wraps the K8s Python client, providing full access to all of the APIS and models available on both platforms. For API version details and additional information visit https://github.com/openshift/openshift-restclient-python
- To avoid SSL certificate validation errors when
validate_certs
is True, the full certificate chain for the API server must be provided viaca_cert
or in the kubeconfig file.
Examples¶
- name: Get an existing Service object
k8s_info:
api_version: v1
kind: Service
name: web
namespace: testing
register: web_service
- name: Get a list of all service objects
k8s_info:
api_version: v1
kind: Service
namespace: testing
register: service_list
- name: Get a list of all pods from any namespace
k8s_info:
kind: Pod
register: pod_list
- name: Search for all Pods labelled app=web
k8s_info:
kind: Pod
label_selectors:
- app = web
- tier in (dev, test)
- name: Search for all running pods
k8s_info:
kind: Pod
field_selectors:
- status.phase=Running
Return Values¶
Common return values are documented here, the following are the fields unique to this module:
Status¶
- This module is not guaranteed to have a backwards compatible interface. [preview]
- This module is maintained by the Ansible Community. [community]
Authors¶
- Will Thames (@willthames)
Hint
If you notice any issues in this documentation, you can edit this document to improve it.