k8s_info – Describe Kubernetes (K8s) objects¶
New in version 2.7.
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_factsbefore Ansible 2.9. The usage did not change.
The below requirements are needed on the host that executes this module.
python >= 2.7
openshift >= 0.6
PyYAML >= 3.11
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_certsis True, the full certificate chain for the API server must be provided via
ca_certor in the kubeconfig file.
- 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
Common return values are documented here, the following are the fields unique to this module: