# tools

* [etcd](#etcd)
  * [check healthy](#check-healthy)
  * [re-add etcd](#re-add-etcd)
* [network](#network)
  * [ingress](#ingress)
* [jobs](#jobs)
* [valut](#valut)
* [eks](#eks)
* [prometheus](#prometheus)
* [others](#others)
  * [How To Create Kubernetes YAML Manifests Quickly](#how-to-create-kubernetes-yaml-manifests-quickly)

### etcd

{% hint style="info" %}
> references:
>
> * [Operating etcd clusters for Kubernetes](https://kubernetes.io/docs/tasks/administer-cluster/configure-upgrade-etcd/)
> * [Set up a High Availability etcd Cluster with kubeadm](https://kubernetes.io/docs/setup/production-environment/tools/kubeadm/setup-ha-etcd-with-kubeadm/)
> * [etcd.io: How to Add and Remove Members](https://etcd.io/docs/v3.6/tutorials/how-to-deal-with-membership/)
{% endhint %}

#### [check healthy](https://faun.pub/kubectl-commands-cheatsheet-43ce8f13adfb)

```bash
$ kubectl get --raw=/healthz/etcd
```

#### re-add etcd

```bash
$ ssh devops@kubernets.master
$ docker run -it \
             -v /var/lib/etcd:/var/lib/etcd \
             -v /etc/kubernetes/pki/etcd:/etc/kubernetes/pki/etcd \
             -p 2380:2380 \
             -p 2379:2379 \
             --network=host \
             k8s.gcr.io/etcd:3.2.24

# running inside docker
$ etcdctl --ca-file /etc/kubernetes/pki/etcd/ca.crt \
          --cert-file /etc/kubernetes/pki/etcd/peer.crt \
          --key-file /etc/kubernetes/pki/etcd/peer.key \
          -endpoints=https://<master3IP>:2379,https://<master2IP>:2379,https://<master1IP>:2379 \
          member list
 >> a874c87fd42044f: name=<master1Hostname> peerURLs=https://<master1IP>:2380 clientURLs=https://<master1IP>:2379 isLeader=true
 >> 3be12ef2ee5f92e7(unstarted): name=<master3Hostname> peerURLs=https://<master3IP>:2380
 >> da3e2155721a00f6: name=<master2Hostname> peerURLs=https://<master2IP>:2380 clientURLs=https://<master2IP>:2379 isLeader=false


# remove "unstarted" node
$ etcdctl --ca-file /etc/kubernetes/pki/etcd/ca.crt \
          --cert-file /etc/kubernetes/pki/etcd/peer.crt \
          --key-file /etc/kubernetes/pki/etcd/peer.key \
          -endpoints=https://<master3IP>:2379,https://<master2IP>:2379,https://<master1IP>:2379 \
          member remove 3be12ef2ee5f92e7

# re-add again
$ etcdctl --ca-file /etc/kubernetes/pki/etcd/ca.crt \
          --cert-file /etc/kubernetes/pki/etcd/peer.crt \
          --key-file /etc/kubernetes/pki/etcd/peer.key \
          -endpoints=https://<master3IP>:2379,https://<master2IP>:2379,https://<master1IP>:2379 \
          member add <master3Hostname> https://<master3IP>:2380
```

### network

#### ingress

![ingress architecture](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-de6c67e18a68db264eb7c7f19761ae64e5b5d166%2Fk8s-ing-architecture-full.png?alt=media)

* traffic flow ![ingress](https://1999659500-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MHqOSW6on5cHbtwcSH6%2Fuploads%2Fgit-blob-e87fbf53624cb2b46ba8fdeb3ff186bc6ea27d54%2Fk8s-ingress-traffic-flow.png?alt=media)

> \[!NOTE|label:references:]
>
> * [Kubernetes Ingress Tutorial For Beginners](https://devopscube.com/kubernetes-ingress-tutorial/)

### jobs

> \[!NOTE|label:references:]
>
> * [How To Create Kubernetes Jobs and Cronjobs – Getting Started Guide](https://devopscube.com/create-kubernetes-jobs-cron-jobs/)

### valut

> \[!NOTE|label:references:]
>
> * [How to Setup Vault in Kubernetes- Beginners Tutorial](https://devopscube.com/vault-in-kubernetes/)

### eks

> \[!NOTE|label:references:]
>
> * [How to Create AWS EKS Cluster Using eksctl](https://devopscube.com/create-aws-eks-cluster-eksctl/)

### prometheus

{% hint style="info" %}
> references:
>
> * [Grafana Cloud documentation](https://grafana.com/docs/grafana-cloud/)
> * [New in Kubernetes Monitoring: cost management, resource usage monitoring, and more](https://grafana.com/blog/2023/11/02/new-in-kubernetes-monitoring-cost-management-resource-usage-monitoring-and-more/)
> * [Explore your infrastructure with Kubernetes Monitoring](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/kubernetes-monitoring/navigate-k8s-monitoring/)
{% endhint %}

### others

#### [How To Create Kubernetes YAML Manifests Quickly](https://devopscube.com/create-kubernetes-yaml/)
