Syntax highlighting

This commit is contained in:
John Mulhausen
2016-02-16 17:53:42 -08:00
parent bbeb111863
commit ee72211075
115 changed files with 1922 additions and 1919 deletions
+18 -18
View File
@@ -40,7 +40,7 @@ This example will work in a custom namespace to demonstrate the concepts involve
Let's create a new namespace called limit-example:
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/namespace.yaml
namespace "limit-example" created
@@ -49,22 +49,22 @@ NAME LABELS STATUS AGE
default <none> Active 5m
limit-example <none> Active 53s
{% endhighlight %}
```
## Step 2: Apply a limit to the namespace
Let's create a simple limit in our namespace.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/limits.yaml --namespace=limit-example
limitrange "mylimits" created
{% endhighlight %}
```
Let's describe the limits that we have imposed in our namespace.
{% highlight console %}
```shell
$ kubectl describe limits mylimits --namespace=limit-example
Name: mylimits
@@ -76,7 +76,7 @@ Pod memory 6Mi 1Gi - - -
Container cpu 100m 2 200m 300m -
Container memory 3Mi 1Gi 100Mi 200Mi -
{% endhighlight %}
```
In this scenario, we have said the following:
@@ -104,7 +104,7 @@ of creation explaining why.
Let's first spin up a replication controller that creates a single container pod to demonstrate
how default values are applied to each pod.
{% highlight console %}
```shell
$ kubectl run nginx --image=nginx --replicas=1 --namespace=limit-example
replicationcontroller "nginx" created
@@ -113,9 +113,9 @@ NAME READY STATUS RESTARTS AGE
nginx-aq0mf 1/1 Running 0 35s
$ kubectl get pods nginx-aq0mf --namespace=limit-example -o yaml | grep resources -C 8
{% endhighlight %}
```
{% highlight yaml %}
```yaml
resourceVersion: "127"
selfLink: /api/v1/namespaces/limit-example/pods/nginx-aq0mf
@@ -135,30 +135,30 @@ spec:
terminationMessagePath: /dev/termination-log
volumeMounts:
{% endhighlight %}
```
Note that our nginx container has picked up the namespace default cpu and memory resource *limits* and *requests*.
Let's create a pod that exceeds our allowed limits by having it have a container that requests 3 cpu cores.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/invalid-pod.yaml --namespace=limit-example
Error from server: error when creating "docs/admin/limitrange/invalid-pod.yaml": Pod "invalid-pod" is forbidden: [Maximum cpu usage per Pod is 2, but limit is 3., Maximum cpu usage per Container is 2, but limit is 3.]
{% endhighlight %}
```
Let's create a pod that falls within the allowed limit boundaries.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/valid-pod.yaml --namespace=limit-example
pod "valid-pod" created
$ kubectl get pods valid-pod --namespace=limit-example -o yaml | grep -C 6 resources
{% endhighlight %}
```
{% highlight yaml %}
```yaml
uid: 162a12aa-7157-11e5-9921-286ed488f785
spec:
@@ -174,7 +174,7 @@ spec:
cpu: "1"
memory: 512Mi
{% endhighlight %}
```
Note that this pod specifies explicit resource *limits* and *requests* so it did not pick up the namespace
default values.
@@ -196,7 +196,7 @@ $ kubelet --cpu-cfs-quota=true ...
To remove the resources used by this example, you can just delete the limit-example namespace.
{% highlight console %}
```shell
$ kubectl delete namespace limit-example
namespace "limit-example" deleted
@@ -204,7 +204,7 @@ $ kubectl get namespaces
NAME LABELS STATUS AGE
default <none> Active 20m
{% endhighlight %}
```
## Summary
+18 -18
View File
@@ -40,7 +40,7 @@ This example will work in a custom namespace to demonstrate the concepts involve
Let's create a new namespace called limit-example:
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/namespace.yaml
namespace "limit-example" created
@@ -49,22 +49,22 @@ NAME LABELS STATUS AGE
default <none> Active 5m
limit-example <none> Active 53s
{% endhighlight %}
```
## Step 2: Apply a limit to the namespace
Let's create a simple limit in our namespace.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/limits.yaml --namespace=limit-example
limitrange "mylimits" created
{% endhighlight %}
```
Let's describe the limits that we have imposed in our namespace.
{% highlight console %}
```shell
$ kubectl describe limits mylimits --namespace=limit-example
Name: mylimits
@@ -76,7 +76,7 @@ Pod memory 6Mi 1Gi - - -
Container cpu 100m 2 200m 300m -
Container memory 3Mi 1Gi 100Mi 200Mi -
{% endhighlight %}
```
In this scenario, we have said the following:
@@ -104,7 +104,7 @@ of creation explaining why.
Let's first spin up a replication controller that creates a single container pod to demonstrate
how default values are applied to each pod.
{% highlight console %}
```shell
$ kubectl run nginx --image=nginx --replicas=1 --namespace=limit-example
replicationcontroller "nginx" created
@@ -113,9 +113,9 @@ NAME READY STATUS RESTARTS AGE
nginx-aq0mf 1/1 Running 0 35s
$ kubectl get pods nginx-aq0mf --namespace=limit-example -o yaml | grep resources -C 8
{% endhighlight %}
```
{% highlight yaml %}
```yaml
resourceVersion: "127"
selfLink: /api/v1/namespaces/limit-example/pods/nginx-aq0mf
@@ -135,30 +135,30 @@ spec:
terminationMessagePath: /dev/termination-log
volumeMounts:
{% endhighlight %}
```
Note that our nginx container has picked up the namespace default cpu and memory resource *limits* and *requests*.
Let's create a pod that exceeds our allowed limits by having it have a container that requests 3 cpu cores.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/invalid-pod.yaml --namespace=limit-example
Error from server: error when creating "docs/admin/limitrange/invalid-pod.yaml": Pod "invalid-pod" is forbidden: [Maximum cpu usage per Pod is 2, but limit is 3., Maximum cpu usage per Container is 2, but limit is 3.]
{% endhighlight %}
```
Let's create a pod that falls within the allowed limit boundaries.
{% highlight console %}
```shell
$ kubectl create -f docs/admin/limitrange/valid-pod.yaml --namespace=limit-example
pod "valid-pod" created
$ kubectl get pods valid-pod --namespace=limit-example -o yaml | grep -C 6 resources
{% endhighlight %}
```
{% highlight yaml %}
```yaml
uid: 162a12aa-7157-11e5-9921-286ed488f785
spec:
@@ -174,7 +174,7 @@ spec:
cpu: "1"
memory: 512Mi
{% endhighlight %}
```
Note that this pod specifies explicit resource *limits* and *requests* so it did not pick up the namespace
default values.
@@ -196,7 +196,7 @@ $ kubelet --cpu-cfs-quota=true ...
To remove the resources used by this example, you can just delete the limit-example namespace.
{% highlight console %}
```shell
$ kubectl delete namespace limit-example
namespace "limit-example" deleted
@@ -204,7 +204,7 @@ $ kubectl get namespaces
NAME LABELS STATUS AGE
default <none> Active 20m
{% endhighlight %}
```
## Summary