modified: README.md
This commit is contained in:
@@ -18,6 +18,7 @@ Kubernetes is an open‑source platform that automates the deployment, scaling,
|
|||||||
- [Patch pv - change to retain policy](#patch-pv---change-to-retain-policy)
|
- [Patch pv - change to retain policy](#patch-pv---change-to-retain-policy)
|
||||||
- [Patch pv - remove finalizers](#patch-pv---remove-finalizers)
|
- [Patch pv - remove finalizers](#patch-pv---remove-finalizers)
|
||||||
- [persistent volume claims](#persistent-volume-claims)
|
- [persistent volume claims](#persistent-volume-claims)
|
||||||
|
- [Create an pod with PVC](#create-an-pod-with-pvc)
|
||||||
- [kubectl](#kubectl)
|
- [kubectl](#kubectl)
|
||||||
- [Helper pods](#helper-pods)
|
- [Helper pods](#helper-pods)
|
||||||
- [network testing](#network-testing)
|
- [network testing](#network-testing)
|
||||||
@@ -113,8 +114,6 @@ metadata:
|
|||||||
name: ubuntu-test
|
name: ubuntu-test
|
||||||
namespace: tests
|
namespace: tests
|
||||||
spec:
|
spec:
|
||||||
#### deploy to an specific node
|
|
||||||
nodeName: chimera-gluten
|
|
||||||
containers:
|
containers:
|
||||||
- name: ubuntu-test
|
- name: ubuntu-test
|
||||||
image: ubuntu
|
image: ubuntu
|
||||||
@@ -126,15 +125,34 @@ spec:
|
|||||||
command: ["sh"] # PID 1 = interactive shell
|
command: ["sh"] # PID 1 = interactive shell
|
||||||
stdin: true # keep STDIN open
|
stdin: true # keep STDIN open
|
||||||
tty: true # allocate a terminal
|
tty: true # allocate a terminal
|
||||||
|
```
|
||||||
|
|
||||||
volumeMounts:
|
or using only CLI (auto removes on exiting).
|
||||||
- name: data
|
|
||||||
mountPath: /data
|
|
||||||
|
|
||||||
volumes:
|
``` bash
|
||||||
- name: data
|
kubectl run ubuntu-test \
|
||||||
persistentVolumeClaim:
|
--image=ubuntu \
|
||||||
claimName: data-pvc
|
--restart=Never \
|
||||||
|
--rm \
|
||||||
|
-it -- bash
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example with busybox, good for network testing.*
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl run net-test \
|
||||||
|
--image=busybox \
|
||||||
|
--restart=Never \
|
||||||
|
--rm -it -- sh
|
||||||
|
```
|
||||||
|
|
||||||
|
*Example with curl, good for network testing.*
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
kubectl run curl-test \
|
||||||
|
--image=curlimages/curl \
|
||||||
|
--restart=Never \
|
||||||
|
--rm -it -- sh
|
||||||
```
|
```
|
||||||
|
|
||||||
**Create an ubuntu pod with and execute command:**
|
**Create an ubuntu pod with and execute command:**
|
||||||
@@ -316,6 +334,41 @@ spec:
|
|||||||
storage: 1Gi
|
storage: 1Gi
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Create an pod with PVC
|
||||||
|
|
||||||
|
**Create an ubuntu pod for tty access example:**
|
||||||
|
|
||||||
|
``` bash
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Pod
|
||||||
|
metadata:
|
||||||
|
name: ubuntu-test
|
||||||
|
namespace: tests
|
||||||
|
spec:
|
||||||
|
#### deploy to an specific node
|
||||||
|
nodeName: chimera-gluten
|
||||||
|
containers:
|
||||||
|
- name: ubuntu-test
|
||||||
|
image: ubuntu
|
||||||
|
# In Kubernetes, the pod stays alive as long as PID 1 is running.
|
||||||
|
# so with this options:
|
||||||
|
# - It does not exit automatically.
|
||||||
|
# - It waits for user input forever.
|
||||||
|
# - It behaves like an interactive shell session.
|
||||||
|
command: ["sh"] # PID 1 = interactive shell
|
||||||
|
stdin: true # keep STDIN open
|
||||||
|
tty: true # allocate a terminal
|
||||||
|
|
||||||
|
volumeMounts:
|
||||||
|
- name: data
|
||||||
|
mountPath: /data
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
- name: data
|
||||||
|
persistentVolumeClaim:
|
||||||
|
claimName: data-pvc
|
||||||
|
```
|
||||||
|
|
||||||
## 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.
|
||||||
|
|||||||
Reference in New Issue
Block a user