在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ansible-collections/kubernetes.core开源软件地址(OpenSource Url):https://github.com/ansible-collections/kubernetes.core开源编程语言(OpenSource Language):Python 99.3%开源软件介绍(OpenSource Introduction):Kubernetes Collection for AnsibleThis repository hosts the The collection includes a variety of Ansible content to help automate the management of applications in Kubernetes and OpenShift clusters, as well as the provisioning and maintenance of clusters themselves. Ansible version compatibilityThis collection has been tested against following Ansible versions: >=2.9.17. For collections that support Ansible 2.9, please ensure you update your Python Support
Note: Python2 is deprecated from 1st January 2020. Please switch to Python3. Kubernetes Version SupportThis collection supports Kubernetes versions >=1.19. Included contentClick on the name of a plugin or module to view that content's documentation: Connection plugins
K8s filter plugins
Inventory plugins
Lookup plugins
Modules
Installation and UsageInstalling the Collection from Ansible GalaxyBefore using the Kubernetes collection, you need to install it with the Ansible Galaxy CLI:
You can also include it in a ---
collections:
- name: kubernetes.core
version: 2.3.1 Installing the Kubernetes Python LibraryContent in this collection requires the Kubernetes Python client to interact with Kubernetes' APIs. You can install it with:
Using modules from the Kubernetes Collection in your playbooksIt's preferable to use content in this collection using their Fully Qualified Collection Namespace (FQCN), for example ---
- hosts: localhost
gather_facts: false
connection: local
tasks:
- name: Ensure the myapp Namespace exists.
kubernetes.core.k8s:
api_version: v1
kind: Namespace
name: myapp
state: present
- name: Ensure the myapp Service exists in the myapp Namespace.
kubernetes.core.k8s:
state: present
definition:
apiVersion: v1
kind: Service
metadata:
name: myapp
namespace: myapp
spec:
type: LoadBalancer
ports:
- port: 8080
targetPort: 8080
selector:
app: myapp
- name: Get a list of all Services in the myapp namespace.
kubernetes.core.k8s_info:
kind: Service
namespace: myapp
register: myapp_services
- name: Display number of Services in the myapp namespace.
debug:
var: myapp_services.resources | count If upgrading older playbooks which were built prior to Ansible 2.10 and this collection's existence, you can also define ---
- hosts: localhost
gather_facts: false
connection: local
collections:
- kubernetes.core
tasks:
- name: Ensure the myapp Namespace exists.
k8s:
api_version: v1
kind: Namespace
name: myapp
state: present For documentation on how to use individual modules and other content included in this collection, please see the links in the 'Included content' section earlier in this README. Ansible Turbo mode Tech PreviewThe ---
- hosts: remote
environment:
ENABLE_TURBO_MODE: 1
tasks:
... To enable Turbo mode for k8s lookup plugin, set the environment variable Please read more about Ansible Turbo mode - here. Testing and DevelopmentIf you want to develop new content for this collection or improve what's already here, the easiest way to work on the collection is to clone it into one of the configured See Contributing to kubernetes.core.
Testing with |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论