first commit :)
This commit is contained in:
115
README.md
115
README.md
@@ -1,2 +1,117 @@
|
||||
# kubernetes
|
||||
|
||||
Kubernetes is an open‑source platform that automates the deployment, scaling, and management of containerized applications. It acts as an orchestrator, ensuring your containers run reliably across clusters of machines, handling networking, storage, and updates without downtime.
|
||||
|
||||
- [k3s](#k3s)
|
||||
- [Install / Setup](#install--setup)
|
||||
- [kubectl](#kubectl)
|
||||
- [Pod delete](#pod-delete)
|
||||
- [OOMKilled](#oomkilled)
|
||||
- [Rollout](#rollout)
|
||||
- [Custom Resource Definitions](#custom-resource-definitions)
|
||||
- [Helper pods](#helper-pods)
|
||||
- [network testing](#network-testing)
|
||||
- [Set Replicas](#set-replicas)
|
||||
- [Resources](#resources)
|
||||
|
||||
## k3s
|
||||
|
||||
K3s is a lightweight, certified Kubernetes distribution designed to run in resource‑constrained environments such as edge devices, IoT appliances, and small servers. It simplifies installation and operation by packaging Kubernetes into a single small binary, while still being fully compliant with the Kubernetes API.
|
||||
|
||||
🌐 What K3s Is
|
||||
|
||||
- Definition: K3s is a simplified Kubernetes distribution created by Rancher Labs (now part of SUSE) and maintained under the CNCF.
|
||||
- Purpose: It’s built for environments where full Kubernetes (K8s) is too heavy — like Raspberry Pis, edge servers, or CI pipelines.
|
||||
- Size: The entire distribution is packaged into a binary under ~70MB.
|
||||
|
||||
### Install / Setup
|
||||
|
||||
**Default master installation:**
|
||||
|
||||
``` bash
|
||||
curl -sfL https://get.k3s.io | sh -
|
||||
```
|
||||
|
||||
## kubectl
|
||||
|
||||
kubectl is the command‑line tool used to interact with Kubernetes clusters. Think of it as the “remote control” for Kubernetes: it lets you deploy applications, inspect resources, and manage cluster operations directly from your terminal.
|
||||
|
||||
### Pod delete
|
||||
|
||||
**Restart local Path Provizionizer:**
|
||||
|
||||
``` bash
|
||||
kubectl delete pod -n kube-system -l app=local-path-provisioner
|
||||
```
|
||||
|
||||
### OOMKilled
|
||||
|
||||
**list all OOMKilled pods:**
|
||||
|
||||
``` bash
|
||||
kubectl get events --all-namespaces | grep -i "OOMKilled"
|
||||
```
|
||||
|
||||
### Rollout
|
||||
|
||||
**rollout coredns:**
|
||||
|
||||
``` bash
|
||||
kubectl rollout restart deployment coredns -n kube-system
|
||||
```
|
||||
|
||||
### Custom Resource Definitions
|
||||
|
||||
- **Definition:** A Custom Resource Definition (CRD) is an extension of the Kubernetes API.
|
||||
|
||||
- **Purpose:** They allow you to define new resource kinds (e.g., Database, Backup, FooBar) that behave like native Kubernetes objects.
|
||||
|
||||
- **Analogy:** By default, Kubernetes understands objects like Pods and Services. With CRDs, you can add your own object types and manage them with kubectl just like built‑in resources
|
||||
|
||||
**List traefik CRDS:**
|
||||
|
||||
```bash
|
||||
kubectl get crds | grep traefik
|
||||
```
|
||||
|
||||
### Helper pods
|
||||
|
||||
#### network testing
|
||||
|
||||
``` bash
|
||||
kubectl run -i --tty dns-test --image=busybox --restart=Never --
|
||||
# Inside the pod:
|
||||
nslookup google.com
|
||||
```
|
||||
|
||||
**from inside the pod:**
|
||||
|
||||
``` bash
|
||||
nslookup google.com
|
||||
```
|
||||
|
||||
### Set Replicas
|
||||
|
||||
**Set deployment replicas to 0:**
|
||||
|
||||
```bash
|
||||
kubectl patch deployment <deployment-name> \
|
||||
-n <namespace> \
|
||||
-p '{"spec":{"replicas":0}}'
|
||||
```
|
||||
|
||||
**Set statefulset replicas to 0:**
|
||||
|
||||
```bash
|
||||
kubectl patch statefulset zigbee2mqtt \
|
||||
-n mqtt \
|
||||
-p '{"spec":{"replicas":1}}'
|
||||
```
|
||||
|
||||
### Resources
|
||||
|
||||
**List all resources:**
|
||||
|
||||
```bash
|
||||
kubectl get all -n kube-system | grep traefik
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user