首页 > 其他 > 详细

ckad练习题-Pod Design

时间:2020-05-05 19:26:26      阅读:81      评论:0      收藏:0      [点我收藏+]

Pod Design (20%)

Defining and Querying Labels and Annotations

  1. Create three different Pods with the names frontendbackend and database that use the image nginx.
  2. Declare labels for those Pods as follows:
  • frontendenv=prodteam=shiny
  • backendenv=prodteam=legacyapp=v1.2.4
  • databaseenv=prodteam=storage
  1. Declare annotations for those Pods as follows:
  • frontendcontact=John Doecommit=2d3mg3
  • backendcontact=Mary Harris
  1. Render the list of all Pods and their labels.
  2. Use label selectors on the command line to query for all production Pods that belong to the teams shiny and legacy.
  3. Remove the label env from the backend Pod and rerun the selection.
  4. Render the surrounding 3 lines of YAML of all Pods that have annotations.

Solution:

You can assign labels upon Pod creation with the --labels option.

$ kubectl run frontend --image=nginx --restart=Never --labels=env=prod,team=shiny
pod/frontend created
$ kubectl run backend --image=nginx --restart=Never --labels=env=prod,team=legacy,app=v1.2.4
pod/backend created
$ kubectl run database --image=nginx --restart=Never --labels=env=prod,team=storage
pod/database created

 

ckad练习题-Pod Design

原文:https://www.cnblogs.com/peteremperor/p/12831704.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!