modified: README.md
This commit is contained in:
59
README.md
59
README.md
@@ -4,6 +4,8 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
|
|
||||||
- [k3s](#k3s)
|
- [k3s](#k3s)
|
||||||
- [Install / Setup](#install--setup)
|
- [Install / Setup](#install--setup)
|
||||||
|
- [Kubernetes DNS](#kubernetes-dns)
|
||||||
|
- [Services DNS Name](#services-dns-name)
|
||||||
- [kubectl](#kubectl)
|
- [kubectl](#kubectl)
|
||||||
- [Pod delete](#pod-delete)
|
- [Pod delete](#pod-delete)
|
||||||
- [OOMKilled](#oomkilled)
|
- [OOMKilled](#oomkilled)
|
||||||
@@ -32,10 +34,28 @@ K3s is a lightweight, certified Kubernetes distribution designed to run in resou
|
|||||||
curl -sfL https://get.k3s.io | sh -
|
curl -sfL https://get.k3s.io | sh -
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Kubernetes DNS
|
||||||
|
|
||||||
|
**Automatic DNS Records:** Kubernetes automatically creates DNS entries for Services and Pods. This allows workloads to connect using predictable names instead of IPs, which may change.
|
||||||
|
|
||||||
|
### Services DNS Name
|
||||||
|
|
||||||
|
```text
|
||||||
|
<service-name>.<namespace>.svc.<cluster-domain>
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example: [test-services.services.svc.cluster.local](test-services.services.svc.cluster.local).*
|
||||||
|
|
||||||
## kubectl
|
## 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.
|
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.
|
||||||
|
|
||||||
|
**Create namespace:**
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl create namespace tests
|
||||||
|
```
|
||||||
|
|
||||||
### Pod delete
|
### Pod delete
|
||||||
|
|
||||||
**Restart local Path Provizionizer:**
|
**Restart local Path Provizionizer:**
|
||||||
@@ -79,17 +99,48 @@ kubectl get crds | grep traefik
|
|||||||
#### network testing
|
#### network testing
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
kubectl run -i --tty dns-test --image=busybox --restart=Never --
|
kubectl run -i --tty dns-test --namespace tests --image=busybox --restart=Never --
|
||||||
# Inside the pod:
|
kubectl delete pod dns-test --namespace tests || 0
|
||||||
nslookup google.com
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**from inside the pod:**
|
**Example using yaml and hostNetwork:**
|
||||||
|
|
||||||
|
- Create Pod
|
||||||
|
|
||||||
|
```yaml
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: dns-test
|
||||||
|
namespace: tests
|
||||||
|
spec:
|
||||||
|
hostNetwork: true
|
||||||
|
containers:
|
||||||
|
- name: dns-test
|
||||||
|
image: busybox
|
||||||
|
command: ["sh"]
|
||||||
|
stdin: true
|
||||||
|
tty: true
|
||||||
|
```
|
||||||
|
|
||||||
|
- Attach to Pod
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl attach -it dns-test -n tests
|
||||||
|
```
|
||||||
|
|
||||||
|
- Execute command inside pod.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
nslookup google.com
|
nslookup google.com
|
||||||
```
|
```
|
||||||
|
|
||||||
|
- Delete pod
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl delete pod dns-test --namespace tests
|
||||||
|
```
|
||||||
|
|
||||||
### Set Replicas
|
### Set Replicas
|
||||||
|
|
||||||
**Set deployment replicas to 0:**
|
**Set deployment replicas to 0:**
|
||||||
|
|||||||
Reference in New Issue
Block a user