mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-03 09:22:44 +00:00
Improve console output in resource quota doc.
This commit is contained in:
parent
e7042a403b
commit
191e303ee0
@ -42,7 +42,7 @@ This example will work in a custom namespace to demonstrate the concepts involve
|
|||||||
|
|
||||||
Let's create a new namespace called quota-example:
|
Let's create a new namespace called quota-example:
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl create -f docs/user-guide/resourcequota/namespace.yaml
|
$ kubectl create -f docs/user-guide/resourcequota/namespace.yaml
|
||||||
$ kubectl get namespaces
|
$ kubectl get namespaces
|
||||||
NAME LABELS STATUS
|
NAME LABELS STATUS
|
||||||
@ -62,7 +62,7 @@ and API resources (pods, services, etc.) that a namespace may consume.
|
|||||||
|
|
||||||
Let's create a simple quota in our namespace:
|
Let's create a simple quota in our namespace:
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl create -f docs/user-guide/resourcequota/quota.yaml --namespace=quota-example
|
$ kubectl create -f docs/user-guide/resourcequota/quota.yaml --namespace=quota-example
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -72,7 +72,7 @@ in the namespace until the quota usage has been calculated. This should happen
|
|||||||
You can describe your current quota usage to see what resources are being consumed in your
|
You can describe your current quota usage to see what resources are being consumed in your
|
||||||
namespace.
|
namespace.
|
||||||
|
|
||||||
```
|
```console
|
||||||
$ kubectl describe quota quota --namespace=quota-example
|
$ kubectl describe quota quota --namespace=quota-example
|
||||||
Name: quota
|
Name: quota
|
||||||
Namespace: quota-example
|
Namespace: quota-example
|
||||||
@ -97,7 +97,7 @@ cpu and memory by creating an nginx container.
|
|||||||
|
|
||||||
To demonstrate, lets create a replication controller that runs nginx:
|
To demonstrate, lets create a replication controller that runs nginx:
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl run nginx --image=nginx --replicas=1 --namespace=quota-example
|
$ kubectl run nginx --image=nginx --replicas=1 --namespace=quota-example
|
||||||
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
|
CONTROLLER CONTAINER(S) IMAGE(S) SELECTOR REPLICAS
|
||||||
nginx nginx nginx run=nginx 1
|
nginx nginx nginx run=nginx 1
|
||||||
@ -105,14 +105,14 @@ nginx nginx nginx run=nginx 1
|
|||||||
|
|
||||||
Now let's look at the pods that were created.
|
Now let's look at the pods that were created.
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl get pods --namespace=quota-example
|
$ kubectl get pods --namespace=quota-example
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
```
|
```
|
||||||
|
|
||||||
What happened? I have no pods! Let's describe the replication controller to get a view of what is happening.
|
What happened? I have no pods! Let's describe the replication controller to get a view of what is happening.
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
kubectl describe rc nginx --namespace=quota-example
|
kubectl describe rc nginx --namespace=quota-example
|
||||||
Name: nginx
|
Name: nginx
|
||||||
Image(s): nginx
|
Image(s): nginx
|
||||||
@ -130,7 +130,7 @@ do not specify any memory usage.
|
|||||||
|
|
||||||
So let's set some default limits for the amount of cpu and memory a pod can consume:
|
So let's set some default limits for the amount of cpu and memory a pod can consume:
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl create -f docs/user-guide/resourcequota/limits.yaml --namespace=quota-example
|
$ kubectl create -f docs/user-guide/resourcequota/limits.yaml --namespace=quota-example
|
||||||
limitranges/limits
|
limitranges/limits
|
||||||
$ kubectl describe limits limits --namespace=quota-example
|
$ kubectl describe limits limits --namespace=quota-example
|
||||||
@ -148,7 +148,7 @@ amount of cpu and memory per container will be applied as part of admission cont
|
|||||||
Now that we have applied default limits for our namespace, our replication controller should be able to
|
Now that we have applied default limits for our namespace, our replication controller should be able to
|
||||||
create its pods.
|
create its pods.
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
$ kubectl get pods --namespace=quota-example
|
$ kubectl get pods --namespace=quota-example
|
||||||
NAME READY STATUS RESTARTS AGE
|
NAME READY STATUS RESTARTS AGE
|
||||||
nginx-t9cap 1/1 Running 0 49s
|
nginx-t9cap 1/1 Running 0 49s
|
||||||
@ -156,8 +156,8 @@ nginx-t9cap 1/1 Running 0 49s
|
|||||||
|
|
||||||
And if we print out our quota usage in the namespace:
|
And if we print out our quota usage in the namespace:
|
||||||
|
|
||||||
```shell
|
```console
|
||||||
kubectl describe quota quota --namespace=quota-example
|
$ kubectl describe quota quota --namespace=quota-example
|
||||||
Name: quota
|
Name: quota
|
||||||
Namespace: default
|
Namespace: default
|
||||||
Resource Used Hard
|
Resource Used Hard
|
||||||
|
Loading…
Reference in New Issue
Block a user