Syntax highlighting
This commit is contained in:
@@ -31,14 +31,14 @@ for namespaces](/{{page.version}}/docs/admin/namespaces)
|
||||
|
||||
You can list the current namespaces in a cluster using:
|
||||
|
||||
{% highlight console %}
|
||||
```shell
|
||||
|
||||
$ kubectl get namespaces
|
||||
NAME LABELS STATUS
|
||||
default <none> Active
|
||||
kube-system <none> Active
|
||||
|
||||
{% endhighlight %}
|
||||
```
|
||||
|
||||
Kubernetes starts with two initial namespaces:
|
||||
* `default` The default namespace for objects with no other namespace
|
||||
@@ -50,12 +50,12 @@ To temporarily set the namespace for a request, use the `--namespace` flag.
|
||||
|
||||
For example:
|
||||
|
||||
{% highlight console %}
|
||||
```shell
|
||||
|
||||
$ kubectl --namespace=<insert-namespace-name-here> run nginx --image=nginx
|
||||
$ kubectl --namespace=<insert-namespace-name-here> get pods
|
||||
|
||||
{% endhighlight %}
|
||||
```
|
||||
|
||||
### Setting the namespace preference
|
||||
|
||||
@@ -64,19 +64,19 @@ context.
|
||||
|
||||
First get your current context:
|
||||
|
||||
{% highlight console %}
|
||||
```shell
|
||||
|
||||
$ export CONTEXT=$(kubectl config view | grep current-context | awk '{print $2}')
|
||||
|
||||
{% endhighlight %}
|
||||
```
|
||||
|
||||
Then update the default namespace:
|
||||
|
||||
{% highlight console %}
|
||||
```shell
|
||||
|
||||
$ kubectl config set-context $(CONTEXT) --namespace=<insert-namespace-name-here>
|
||||
|
||||
{% endhighlight %}
|
||||
```
|
||||
|
||||
## Namespaces and DNS
|
||||
|
||||
|
||||
Reference in New Issue
Block a user