geerlingguy / ansible-collection-k8s Goto Github PK
View Code? Open in Web Editor NEWCollection of Kubernetes automation tools for Ansible
Home Page: https://galaxy.ansible.com/geerlingguy/k8s
Collection of Kubernetes automation tools for Ansible
Home Page: https://galaxy.ansible.com/geerlingguy/k8s
roles/k8s_manifests/.git
Files like above should not be packaged in the collection, having that file breaks git status
and other commands, and prevents ansible-test
from working when that collection is installed.
Hi All,
I am new to ansible and trying to set up k8s cluster using this collection.
I have installed ansible and define master node and worker node details in /etc/ansible/hosts file.
I am not sure where to mention these node details if I use geerlingguy/ansible-collection-k8s collection.
I have gone through all yml files but no luck.
Please help me.
Basically build a module that makes it simpler to pass in a template (e.g. my-manifest.yml) which can have one or more YAML documents. Parse each document separately, template it via Jinja2, and then pass it to the K8s API as the normal k8s module does...
I added a simple test scenario that verifies the k8s_manifests
role in #1, now I'd like to add a scenario that verifies the kubernetes
role.
I could use the ubuntu1804 or debian10 ansible base image and then run the role inside with defaults.
The basic idea:
kubernetes
role to set up kubernetes on a single node instance.Can you please help! I can't setup dashboard
- name: Check if Kubernetes Dashboard UI service already exists.
shell: kubectl get services --namespace kube-system | grep -q kubernetes-dashboard
changed_when: false
**failed_when: false**
register: kubernetes_dashboard_service
when: kubernetes_enable_web_ui | bool
- name: Enable the Kubernetes Web Dashboard UI (if configured).
command: "kubectl create -f {{ kubernetes_web_ui_manifest_file }}"
when:
- kubernetes_enable_web_ui | bool
- **kubernetes_dashboard_service is failed**
The output if I run is the following
TASK [geerlingguy.kubernetes : Check if Kubernetes Dashboard UI service already exists.] **************************************************************************************************************************************************************************************
ok: [193.224.23.11]
TASK [geerlingguy.kubernetes : Enable the Kubernetes Web Dashboard UI (if configured).] ***************************************************************************************************************************************************************************************
skipping: [193.224.23.11]
If I run the command it fails, only the failed_when: false
override it
$ ansible -i hosts -b -u debian k8s-1 -m shell -a "kubectl get services --namespace kube-system | grep -q kubernetes-dashboard"
193.224.23.11 | FAILED | rc=1 >>
non-zero return code
$
Any hint would be appreciated!
Thanks!
Just wanted to throw this out here, since it's something that would be convenient in a number of circumstances.
A common pattern for K8s deployments is:
Currently, for number 2, you can futz around with the returned data from k8s
or k8s_info
and use until/retries to get something working, or you can do a more simple method (if you have kubectl
available) using kubectl wait
:
kubectl wait --for=condition=Ready pods --selector app=my-app-name --timeout=60s
At a basic level, I'd want something like:
- name: Wait for my-app-name pods to be ready.
k8s_wait:
for: condition=Ready
type: pods
selector:
- app=my-app-name
timeout: 60s
Something along those lines... not sure. But it would be nice to be able to specify this in a more structured way, and not have to rely on kubectl
being present for a task like:
- name: Wait for my-app-name pods to be ready.
command: >
kubectl wait --for=condition=Ready
pods --selector app=my-app-name --timeout=60s
changed_when: false
See related: geerlingguy/ansible-collection-php_roles#3
And a blog post explaining how to do it: Automatically building and publishing Ansible Galaxy Collections
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.