Skip to content

Instantly share code, notes, and snippets.

View amaurybsouza's full-sized avatar
:octocat:
Automating everything!

Amaury Borges Souza amaurybsouza

:octocat:
Automating everything!
View GitHub Profile
# helm repo update
Hang tight while we grab the latest from your chart repositories...
...Successfully got an update from the "prometheus-community" chart repository
...Successfully got an update from the "grafana" chart repository
Update Complete. ⎈Happy Helming!⎈
# helm repo list
NAME URL
prometheus-community https://prometheus-community.github.io/helm-charts
grafana https://grafana.github.io/helm-charts
helm repo add prometheus-community https://prometheus-community.github.io/helm-charts
helm repo add grafana https://grafana.github.io/helm-charts
helm completion bash > /etc/bash_completion.d/helm
# helm help
The Kubernetes package manager
Common actions for Helm:
- helm search: search for charts
- helm pull: download a chart to your local directory to view
- helm install: upload the chart to Kubernetes
- helm list: list releases of charts
$ curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
$ chmod 700 get_helm.sh
$ ./get_helm.sh
gather_facts: false
tasks:
- name: Checking the Kubernetes Nodes
shell:
kubectl get nodes
register: results
- name: Print the Kubernetes Nodes
debug:
msg: "{{ results.stdout.split('\n') }}"
---
# Author: Amaury Borges Souza
# Description: Kubernetes Cluster Health Check
# Usage: ansible-playbook kubernetes_health_check.yml -i inventory.yml
# Ansible_version: ansible 2.10.8
# License: GNU General Public License
- name: Kubernetes Cluster Health Check
hosts: k8s
become: true
gather_facts: false
@amaurybsouza
amaurybsouza / gist:1be9400274352f155fbaeca5e1d26918
Created June 19, 2022 18:06
kubernetes_cluster_ansible_status
# ansible k8s -m command -a "kubectl get componentstatuses" -i inventory.yml
k8s | CHANGED | rc=0 >>
NAME STATUS MESSAGE ERROR
controller-manager Healthy ok
scheduler Healthy ok
etcd-0 Healthy {"health":"true","reason":""} Warning: v1 ComponentStatus is deprecated in v1.19+
@amaurybsouza
amaurybsouza / gist:6556c4305b954abf04466885e72c08c6
Created June 19, 2022 17:58
kubernetes_cluster_ansible_events_logs
# ansible k8s -m command -a " kubectl get events --all-namespaces --sort-by=.metadata.creationTimestamp" -i inventory.yml
k8s | CHANGED | rc=0 >>
NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE
default 42m Normal Pulling pod/busybox Pulling image "busybox"
default 42m Normal Created pod/busybox Created container busy
default 42m Normal Started pod/busybox Started container busy
default 42m Normal Pulled pod/busybox Successfully pulled image "busybox" in 1.441018829s
kube-system 12m Normal ScalingReplicaSet deployment/metrics-server Scaled up replica set metrics-server-678f4bf65b to 1
kube-system 12m Normal SuccessfulCreate replicaset/metrics-server-678f4bf65b Created pod: metrics-server-67