Pour tout problème contactez-nous par mail : support@froggit.fr | La FAQ :grey_question: | Rejoignez-nous sur le Chat :speech_balloon:

Skip to content
Snippets Groups Projects
Commit c420721e authored by Marc Beninca's avatar Marc Beninca
Browse files

kube/labels,selectors

parent f048e2e6
Branches master
No related tags found
No related merge requests found
......@@ -536,3 +536,85 @@ Write
secretKeyRef:
name: username
key: username
Labels & Selectors
==================
Labels
------
* Key/Value pairs
* attached to objects
Reserved key prefixes:
* kubernetes.io
* k8s.io
Selectors
---------
* use labels
* filter/select objects
Types:
* matchLabels: =, ==, !=
* matchExpressions: exists, in, notin
Commands
--------
.. code:: shell
kubectl \
get pod \
--show-labels \
-n my-namespace
.. code:: shell
kubectl \
get pod \
-l app=my-app,version=1.0 \
-n my-namespace
.. code:: shell
kubectl \
get pod \
-l app=my-app,version in (1.0,1.1,1.2) \
-n my-namespace
.. code:: yaml
apiVersion: v1
kind: Pod
metadata:
name: my-pod
labels:
app: my-app
version: 1.0
spec:
containers:
- name: my-container
image: my-image
.. code:: yaml
apiVersion: v1
kind: Deployment
metadata:
name: my-deployment
labels:
app: my-app
spec:
containers:
- name: my-container
image: my-image
selector:
matchLabels:
app: my-app
matchExpressions:
- {key: version, operator: In, values: ["1.0","1.1","1.2"]}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment