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
@amaurybsouza
amaurybsouza / gist:94baade5372b225230468ea7dae70f9b
Created June 19, 2022 17:39
Kubernetes_cluster_ansible_events
# ansible k8s -m command -a "kubectl get events" -i inventory.yml
k8s | CHANGED | rc=0 >>
LAST SEEN TYPE REASON OBJECT MESSAGE
23m Normal Pulling pod/busybox Pulling image "busybox"
23m Normal Created pod/busybox Created container busy
23m Normal Started pod/busybox Started container busy
23m Normal Pulled pod/busybox Successfully pulled image "busybox" in 1.441018829s
@amaurybsouza
amaurybsouza / gist:5328198a338ccf55fee59fefeaf248fa
Created June 19, 2022 17:00
kubernetes_cluster_info_ansible
# ansible k8s -m command -a "kubectl cluster-info" -i inventory.yml
k8s | CHANGED | rc=0 >>
Kubernetes control plane is running at https://192.168.1.123:6443
CoreDNS is running at https://192.168.1.123:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
@amaurybsouza
amaurybsouza / gist:c83f7ee999bb076b497894d04e7733dc
Created June 19, 2022 16:57
kubernetes_cluster_ansible_node
# ansible k8s -m shell -a "kubectl get nodes -o wide" -i inventory.yml
k8s | CHANGED | rc=0 >>
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kubernetes-cluster Ready control-plane 3d1h v1.24.2 192.168.1.132 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node01 Ready <none> 3d1h v1.24.1 192.168.1.122 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node02 Ready <none> 3d1h v1.24.1 192.168.1.123 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node03 Ready <none> 3d1h v1.24.1 192.168.1.125 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
# kubectl get nodes -o wide
NAME STATUS ROLES AGE VERSION INTERNAL-IP EXTERNAL-IP OS-IMAGE KERNEL-VERSION CONTAINER-RUNTIME
kubernetes-cluster Ready control-plane 3d1h v1.24.2 192.168.1.129 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node01 Ready <none> 3d1h v1.24.1 192.168.1.132 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node02 Ready <none> 3d1h v1.24.1 192.168.1.123 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
kubernetes-node03 Ready <none> 3d1h v1.24.1 192.168.1.122 <none> CentOS Linux 7 (Core) 3.10.0-1160.66.1.el7.x86_64 containerd://1.6.6
# kubectl get componentstatuses
Warning: v1 ComponentStatus is deprecated in v1.19+
NAME STATUS MESSAGE ERROR
scheduler Healthy ok
controller-manager Healthy ok
etcd-0 Healthy {"health":"true","reason":""}
# kubectl cluster-info
Kubernetes control plane is running at https://192.168.1.129:6443
CoreDNS is running at https://192.168.1.129:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.
@amaurybsouza
amaurybsouza / gist:201d4d4826449aa92629897db646781b
Created June 19, 2022 14:42
kubernetes_cluster_get_nodes
# ansible k8s -m shell -a "kubectl get nodes" -i inventory.yml
k8s | CHANGED | rc=0 >>
NAME STATUS ROLES AGE VERSION
kubernetes-cluster Ready control-plane 2d23h v1.24.2
kubernetes-node01 Ready <none> 2d23h v1.24.1
kubernetes-node02 Ready <none> 2d23h v1.24.1
kubernetes-node03 Ready <none> 2d23h v1.24.1
@amaurybsouza
amaurybsouza / gist:369dff45767d0dbca74f5cbca732b0b4
Created June 19, 2022 14:11
kubernetes_cluster_events_parte02
# kubectl get events --all-namespaces --sort-by=.metadata.creationTimestamp
NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE
default 59m Normal Pulling pod/busybox Pulling image "busybox"
default 59m Normal Created pod/busybox Created container busy
default 59m Normal Started pod/busybox Started container busy
default 59m Normal Pulled pod/busybox Successfully pulled image "busybox" in 1.606189033s
kube-system 4m55s Warning Unhealthy pod/kube-apiserver-kubernetes-cluster Liveness probe failed: HTTP probe failed with statuscode: 500
kube-system 62s Warning Unhealthy pod/kube-apiserver-kubernetes-cluster Readiness probe failed: HTTP probe failed
]# kubectl get events --all-namespaces --sort-by=.metadata.creationTimestamp
NAMESPACE LAST SEEN TYPE REASON OBJECT MESSAGE
default 54m Normal Pulling pod/busybox Pulling image "busybox"
default 54m Normal Created pod/busybox Created container busy
default 54m Normal Started pod/busybox Started container busy
default 54m Normal Pulled pod/busybox Successfully pulled image "busybox" in 1.606189033s
kube-system 63s Warning Unhealthy pod/kube-apiserver-kubernetes-cluster Liveness probe failed: HTTP probe failed with statuscode: 500
kube-system 61s Warning Unhealthy pod/kube-apiserver-kubernetes-cluster Readiness probe failed: HTTP probe failed with statuscode: 500
kube-system 75s Warning Unhealthy pod/etcd-kubernetes-cluster
# kubectl get events --all-namespaces --
--allow-missing-template-keys --client-key --kustomize --password --server-print --token
--as --cluster --label-columns --profile --show-kind --user
--as-group --context --log-flush-frequency --profile-output --show-labels --username
--as-uid --field-selector --match-server-version --raw --show-managed-fields --v
--cache-dir --filename --namespace --recursive --sort-by --vmodule
--certificate-authority --ignore-not-found --no-headers --request-timeout --subresource --warnings-as