first commit

This commit is contained in:
iProbe 2022-10-18 16:59:37 +08:00
commit ba848e218d
1001 changed files with 152333 additions and 0 deletions

View file

@ -0,0 +1,50 @@
### 创建命名空间
```
kubectl create namespace demo-ns
```
### 创建LimitRange, cpu-limit.yaml
```
apiVersion: v1
kind: LimitRange
metadata:
name: cpu-limit-range
spec:
limits:
- default:
cpu: 1
defaultRequest:
cpu: 0.5
type: Container
```
### 命名空间上施加限制
```
kubectl apply cpu-limit.yaml --namespace demo-ns
```
### 在该命名空间下创建pod定义pod-limit-c-demo1.yaml
```
apiVersion: v1
kind: Pod
metadata:
name: pod-lc-demo1
namespace: demo-ns
labels:
app: pod-lc
version: v1
spec:
containers:
- name: pod-demo1-c
image: busybox
ports:
- name: demo1-c-http
containerPort: 80
```
### 创建pod
```
kubectl apply pod-limit-c-demo1.yaml
```

View file

@ -0,0 +1,50 @@
### 创建命名空间
```
kubectl create namespace demo-ns
```
### 创建LimitRange, memory-limit.yaml
```
apiVersion: v1
kind: LimitRange
metadata:
name: mem-limit-range
spec:
limits:
- default:
memory: 512Mi
defaultRequest:
memory: 256Mi
type: Container
```
### 命名空间上施加限制
```
kubectl apply memory-limit.yaml --namespace demo-ns
```
### 在该命名空间下创建pod定义pod-limit-m-demo1.yaml
```
apiVersion: v1
kind: Pod
metadata:
name: pod-lm-demo1
namespace: demo-ns
labels:
app: pod-lm
version: v1
spec:
containers:
- name: pod-demo1-m
image: busybox
ports:
- name: demo1-m-http
containerPort: 80
```
### 创建pod
```
kubectl apply pod-limit-m-demo1.yaml
```

View file

@ -0,0 +1,16 @@
```
apiVersion: v1
kind: ResourceQuota
metadata:
name: rq-demo-ns
namespace: demo-ns
spec:
hard:
requests.cpu: 500m
requests.memory: 1Gi
limits.cpu: 1000m
limits.memory: 2Gi
```