在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称(OpenSource Name):ansible-collections/community.kubernetes开源软件地址(OpenSource Url):https://github.com/ansible-collections/community.kubernetes开源编程语言(OpenSource Language):Makefile 100.0%开源软件介绍(OpenSource Introduction):Kubernetes Collection for AnsibleIMPORTANT
The This repo 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. 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: community.kubernetes
version: 2.0.1 Installing the OpenShift Python LibraryContent in this collection requires the OpenShift 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.
community.kubernetes.k8s:
api_version: v1
kind: Namespace
name: myapp
state: present
- name: Ensure the myapp Service exists in the myapp Namespace.
community.kubernetes.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.
community.kubernetes.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:
- community.kubernetes
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. 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 community.kubernetes.
Testing with |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论