Difference between revisions of "Kubernetes selectors"

From wikieduonline
Jump to navigation Jump to search
 
(8 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
* https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
 
* https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/
  
  [[kubectl get pods]] [[--selector]]=app=YOUR_APP
+
* <code>[[kind: Deployment]], [[kind: Service]]</code> (Services without selectors)
  
  [[kubectl get pods]] [[--selector]]=app=YOUR_APP -o=[[jsonpath]]='{.items[0].metadata.name}'
 
  
[[kubectl get pods]] [[--field-selector]] [[status.]]phase=Running <ref>https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/</ref>
+
== Examples ==
 +
* <code>[[kubectl get pods]] [[--selector]]=app=YOUR_APP</code>
 +
 
 +
* <code>[[kubectl get pods]] [[--selector]]=app=YOUR_APP -o=[[jsonpath]]='{.items[0].metadata.name}'</code>
 +
 
 +
* <code>[[kubectl get pods]] [[--field-selector]] [[status.]]phase=Running</code> <ref>https://kubernetes.io/docs/concepts/overview/working-with-objects/field-selectors/</ref>
  
 
  [[selector:]]
 
  [[selector:]]
Line 21: Line 25:
  
  
 +
{{PDB example}}
 +
 +
 +
kind: [[AWSNodeTemplate]]
 +
spec:
 +
  [[subnetSelector]]:
 +
    [[karpenter.sh/discovery]]: ${CLUSTER_NAME}
 +
  securityGroupSelector:
 +
    karpenter.sh/discovery: ${CLUSTER_NAME}
  
 
== Related ==
 
== Related ==
Line 27: Line 40:
 
* [[Kubernetes field selectors]]
 
* [[Kubernetes field selectors]]
 
* [[CKA v1.21: Understand how to use Labels, Selector and Annotations]]
 
* [[CKA v1.21: Understand how to use Labels, Selector and Annotations]]
0/2 nodes are available: 1 Too many pods, 1 nodes(s) [[didn't match Pod's node affinity/selector]]
+
* <code>0/2 nodes are available: 1 Too many pods, 1 nodes(s) [[didn't match Pod's node affinity/selector]]</code>
 +
* [[spec.selector]]
  
 
== See also ==
 
== See also ==

Latest revision as of 08:43, 3 October 2024

Advertising: