Reader small image

You're reading from  Kubernetes for Developers

Product typeBook
Published inApr 2018
Reading LevelIntermediate
PublisherPackt
ISBN-139781788834759
Edition1st Edition
Languages
Right arrow
Author (1)
Joseph Heck
Joseph Heck
author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck

Right arrow

Kubernetes concepts – selectors


Selectors are used in Kubernetes to connect resources together based on the labels they have (or don’t have). A selector is meant to provide a means to retrieve a set of resources in Kubernetes.

Most of the kubectl commands support a -l option that allows you to provide a selector to filter what it finds.

A Selector can be equality-based to represent specific values, or set-based to allow filtering and selection based on multiple values. Equality selectors use = or !=. Set selectors use in, notin, and exists. You can combine these in a selector to create more complex filters and selection criteria by appending the selectors together with a , between them.

For example, you might use a label app to represent a grouping of Pods that provide service to a specific application - in this case using the value flask and tier to represent the values of front-end, cache, and back-end tiers. A selector that would return all resources related to the app might be:

app=flask...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kubernetes for Developers
Published in: Apr 2018Publisher: PacktISBN-13: 9781788834759

Author (1)

author image
Joseph Heck

Joseph Heck has broad development and management experience across start-ups and large companies. He has architected, developed, and deployed a wide variety of solutions, ranging from mobile and desktop applications to cloud-based distributed systems. He builds and directs teams and mentors individuals to improve the way they build, validate, deploy, and run software. He also works extensively with and in open source, collaborating across many projects, including Kubernetes.
Read more about Joseph Heck