modified: README.md
This commit is contained in:
1 parent
adb0d7dd21
commit
dde2924e95
1 file changed
+53
-72
@@ -3,6 +3,9 @@
|
|||||||
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.
|
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.
|
||||||
|
|
||||||
- [kubernetes](#kubernetes)
|
- [kubernetes](#kubernetes)
|
||||||
|
- [kubectl](#kubectl)
|
||||||
|
- [Env variables](#env-variables)
|
||||||
|
- [Resources](#resources)
|
||||||
- [Namespaces](#namespaces)
|
- [Namespaces](#namespaces)
|
||||||
- [Create namespace](#create-namespace)
|
- [Create namespace](#create-namespace)
|
||||||
- [namespace stuck on delete](#namespace-stuck-on-delete)
|
- [namespace stuck on delete](#namespace-stuck-on-delete)
|
||||||
@@ -13,6 +16,7 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
- [Failed pods](#failed-pods)
|
- [Failed pods](#failed-pods)
|
||||||
- [delete all pods with prefix](#delete-all-pods-with-prefix)
|
- [delete all pods with prefix](#delete-all-pods-with-prefix)
|
||||||
- [OOMKilled](#oomkilled)
|
- [OOMKilled](#oomkilled)
|
||||||
|
- [network testing](#network-testing)
|
||||||
- [Attach to an pod](#attach-to-an-pod)
|
- [Attach to an pod](#attach-to-an-pod)
|
||||||
- [Run command on pod](#run-command-on-pod)
|
- [Run command on pod](#run-command-on-pod)
|
||||||
- [Keep pod Alive](#keep-pod-alive)
|
- [Keep pod Alive](#keep-pod-alive)
|
||||||
@@ -24,10 +28,6 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
- [check orphans](#check-orphans)
|
- [check orphans](#check-orphans)
|
||||||
- [persistent volume claims](#persistent-volume-claims)
|
- [persistent volume claims](#persistent-volume-claims)
|
||||||
- [Create an pod with PVC](#create-an-pod-with-pvc)
|
- [Create an pod with PVC](#create-an-pod-with-pvc)
|
||||||
- [kubectl](#kubectl)
|
|
||||||
- [Helper pods](#helper-pods)
|
|
||||||
- [network testing](#network-testing)
|
|
||||||
- [Resources](#resources)
|
|
||||||
- [Services Accounts](#services-accounts)
|
- [Services Accounts](#services-accounts)
|
||||||
- [configMap](#configmap)
|
- [configMap](#configmap)
|
||||||
- [Secrets](#secrets)
|
- [Secrets](#secrets)
|
||||||
@@ -81,6 +81,24 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
- [hosting](#hosting)
|
- [hosting](#hosting)
|
||||||
- [misc](#misc)
|
- [misc](#misc)
|
||||||
|
|
||||||
|
## 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.
|
||||||
|
|
||||||
|
### Env variables
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
export KUBECONFIG=/path/to/kubeconfig
|
||||||
|
```
|
||||||
|
|
||||||
|
### Resources
|
||||||
|
|
||||||
|
**List all resources:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
kubectl get all -n kube-system | grep traefik
|
||||||
|
```
|
||||||
|
|
||||||
## Namespaces
|
## Namespaces
|
||||||
|
|
||||||
### Create namespace
|
### Create namespace
|
||||||
@@ -222,6 +240,24 @@ spec:
|
|||||||
type: DirectoryOrCreate
|
type: DirectoryOrCreate
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**Example using yaml and hostNetwork:**
|
||||||
|
|
||||||
|
```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
|
||||||
|
```
|
||||||
|
|
||||||
### Get Pod
|
### Get Pod
|
||||||
|
|
||||||
**Get pod name by label ap:**
|
**Get pod name by label ap:**
|
||||||
@@ -257,7 +293,6 @@ kubectl delete pod -n appNamespace -l app=myAppName
|
|||||||
|
|
||||||
### Failed pods
|
### Failed pods
|
||||||
|
|
||||||
|
|
||||||
List all.
|
List all.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
@@ -316,6 +351,19 @@ sudo journalctl -k --since "1 hour ago" | grep -Ei "oom|kill"
|
|||||||
sudo journalctl -k -o short-iso | grep -Ei "oom|kill"
|
sudo journalctl -k -o short-iso | grep -Ei "oom|kill"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### network testing
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl run -i --tty dns-test --namespace tests --image=busybox --restart=Never --
|
||||||
|
kubectl delete pod dns-test --namespace tests || 0
|
||||||
|
```
|
||||||
|
|
||||||
|
- Execute command inside pod.
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
nslookup google.com
|
||||||
|
```
|
||||||
|
|
||||||
### Attach to an pod
|
### Attach to an pod
|
||||||
|
|
||||||
Attach connects your terminal to the main process of the container (PID 1), or another running process if specified.
|
Attach connects your terminal to the main process of the container (PID 1), or another running process if specified.
|
||||||
@@ -503,73 +551,6 @@ spec:
|
|||||||
claimName: data-pvc
|
claimName: data-pvc
|
||||||
```
|
```
|
||||||
|
|
||||||
## 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.
|
|
||||||
|
|
||||||
### Helper pods
|
|
||||||
|
|
||||||
#### network testing
|
|
||||||
|
|
||||||
``` bash
|
|
||||||
kubectl run -i --tty dns-test --namespace tests --image=busybox --restart=Never --
|
|
||||||
kubectl delete pod dns-test --namespace tests || 0
|
|
||||||
```
|
|
||||||
|
|
||||||
**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
|
|
||||||
nslookup google.com
|
|
||||||
```
|
|
||||||
|
|
||||||
- Delete pod
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl delete pod dns-test --namespace tests
|
|
||||||
```
|
|
||||||
|
|
||||||
### Resources
|
|
||||||
|
|
||||||
**List all resources:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get all -n kube-system | grep traefik
|
|
||||||
```
|
|
||||||
|
|
||||||
**List service accounts:**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
kubectl get serviceAccount --all-namespaces
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### Services Accounts
|
### Services Accounts
|
||||||
|
|
||||||
**List all:**
|
**List all:**
|
||||||
|
|||||||
Reference in new issue
Block a user