Skip to content

Commit 1e3e03c

Browse files
committed
Add french version of object namespace
1 parent 75b9b63 commit 1e3e03c

File tree

1 file changed

+128
-0
lines changed
  • content/fr/docs/concepts/overview/working-with-objects

1 file changed

+128
-0
lines changed
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
---
2+
reviewers:
3+
- derekwaynecarr
4+
- mikedanese
5+
- thockin
6+
title: Namespaces
7+
content_type: concept
8+
weight: 30
9+
---
10+
11+
<!-- overview -->
12+
13+
Kubernetes supports multiple virtual clusters backed by the same physical cluster.
14+
These virtual clusters are called namespaces.
15+
16+
17+
18+
19+
<!-- body -->
20+
21+
## When to Use Multiple Namespaces
22+
23+
Namespaces are intended for use in environments with many users spread across multiple
24+
teams, or projects. For clusters with a few to tens of users, you should not
25+
need to create or think about namespaces at all. Start using namespaces when you
26+
need the features they provide.
27+
28+
Namespaces provide a scope for names. Names of resources need to be unique within a namespace,
29+
but not across namespaces. Namespaces can not be nested inside one another and each Kubernetes
30+
resource can only be in one namespace.
31+
32+
Namespaces are a way to divide cluster resources between multiple users (via [resource quota](/docs/concepts/policy/resource-quotas/)).
33+
34+
In future versions of Kubernetes, objects in the same namespace will have the same
35+
access control policies by default.
36+
37+
It is not necessary to use multiple namespaces just to separate slightly different
38+
resources, such as different versions of the same software: use [labels](/docs/user-guide/labels) to distinguish
39+
resources within the same namespace.
40+
41+
## Working with Namespaces
42+
43+
Creation and deletion of namespaces are described in the [Admin Guide documentation
44+
for namespaces](/docs/admin/namespaces).
45+
46+
{{< note >}}
47+
Avoid creating namespace with prefix `kube-`, since it is reserved for Kubernetes system namespaces.
48+
{{< /note >}}
49+
50+
### Viewing namespaces
51+
52+
You can list the current namespaces in a cluster using:
53+
54+
```shell
55+
kubectl get namespace
56+
```
57+
```
58+
NAME STATUS AGE
59+
default Active 1d
60+
kube-node-lease Active 1d
61+
kube-public Active 1d
62+
kube-system Active 1d
63+
```
64+
65+
Kubernetes starts with four initial namespaces:
66+
67+
* `default` The default namespace for objects with no other namespace
68+
* `kube-system` The namespace for objects created by the Kubernetes system
69+
* `kube-public` This namespace is created automatically and is readable by all users (including those not authenticated). This namespace is mostly reserved for cluster usage, in case that some resources should be visible and readable publicly throughout the whole cluster. The public aspect of this namespace is only a convention, not a requirement.
70+
* `kube-node-lease` This namespace for the lease objects associated with each node which improves the performance of the node heartbeats as the cluster scales.
71+
72+
### Setting the namespace for a request
73+
74+
To set the namespace for a current request, use the `--namespace` flag.
75+
76+
For example:
77+
78+
```shell
79+
kubectl run nginx --image=nginx --namespace=<insert-namespace-name-here>
80+
kubectl get pods --namespace=<insert-namespace-name-here>
81+
```
82+
83+
### Setting the namespace preference
84+
85+
You can permanently save the namespace for all subsequent kubectl commands in that
86+
context.
87+
88+
```shell
89+
kubectl config set-context --current --namespace=<insert-namespace-name-here>
90+
# Validate it
91+
kubectl config view --minify | grep namespace:
92+
```
93+
94+
## Namespaces and DNS
95+
96+
When you create a [Service](/docs/user-guide/services), it creates a corresponding [DNS entry](/docs/concepts/services-networking/dns-pod-service/).
97+
This entry is of the form `<service-name>.<namespace-name>.svc.cluster.local`, which means
98+
that if a container just uses `<service-name>`, it will resolve to the service which
99+
is local to a namespace. This is useful for using the same configuration across
100+
multiple namespaces such as Development, Staging and Production. If you want to reach
101+
across namespaces, you need to use the fully qualified domain name (FQDN).
102+
103+
## Not All Objects are in a Namespace
104+
105+
Most Kubernetes resources (e.g. pods, services, replication controllers, and others) are
106+
in some namespaces. However namespace resources are not themselves in a namespace.
107+
And low-level resources, such as [nodes](/docs/admin/node) and
108+
persistentVolumes, are not in any namespace.
109+
110+
To see which Kubernetes resources are and aren't in a namespace:
111+
112+
```shell
113+
# In a namespace
114+
kubectl api-resources --namespaced=true
115+
116+
# Not in a namespace
117+
kubectl api-resources --namespaced=false
118+
```
119+
120+
121+
122+
## {{% heading "whatsnext" %}}
123+
124+
* Learn more about [creating a new namespace](/docs/tasks/administer-cluster/namespaces/#creating-a-new-namespace).
125+
* Learn more about [deleting a namespace](/docs/tasks/administer-cluster/namespaces/#deleting-a-namespace).
126+
127+
128+

0 commit comments

Comments
 (0)