Pod Controller of Kubernetes

Source: Internet
Author: User

Define common resources for pods pods.spec.containers

-Name <string> #containers names

Image <string> #镜像地址

Imagepullpolicy <string> #如果标签是latest is always (download image) Ifnotpresent (see if there is a local image, if not download) never (using local mirror)

Ports <[]Object> #是给对象列表 can expose multiple ports can be defined for each port's attribute definition such as: (The name (can be called later) port number protocol exposed to the address) exposed ports only provide additional information, can not limit the system is really exposed

-Containerport Container Port

HostIP host address (basic not used)

Hostport Node Port

Name names

Protocol (default is TCP)

Args <[]string> pass parameters to command equivalent to CMD in Docker

Command <[]string> equivalent to entrypoint (reference address) in Docker

    • If the pod does not provide command or args using container, use cmd or entrypoint in the Docker image.

    • if pod provides command but not provided args , use only the provided command the. entrypoint and cmd are defined in the Docker image will be ignored.

    • If the pod only provides args , it args will be supplied as a parameter to the Docker image entrypoint .
    • If you provide a command and the args , the entrypoint and cmd in the Docker image will not take effect,and thepod args will be used as a parameter to command运行 .
Label

Key=value

    • Key: Use only alphanumeric _-. (can only start with an alphanumeric character, not more than 63 characters)
    • Value: Can be empty only with alpha-numeric start
#显示标签 $ kubectl Get pods--show-Labelsname Ready STATUS restarts age LABELSJDK-94bcfc779-fs2cl1/1Running08d pod-template-hash=506797335, workload.user.cattle.io/workloadselector=deployment-default-Jdkmysql-5ffdf958d9-7qdnv1/1Running13d pod-template-hash=1998951485, workload.user.cattle.io/workloadselector=deployment-default-mysql#-L show pod with app tag and print value under App tab $ kubectl get pods--all-namespaces-L appnamespace NAME ready STATUS restarts age appcattle< /c4>-alerting alertmanager-649c5fc4d7-4hp9q2/2Running01d Alertmanagercattle-system CATTLE-CLUSTER-AGENT-6D7C847588-F6CMT1/1Running228d cattle-cluster-Agentcattle-system Cattle-node-agent-9m2ls1/1Running228d cattle-Agentcattle-system CATTLE-NODE-AGENT-9NGFH1/1Running012d cattle-Agentcattle-system cattle-node-agent-j862c1/1Running112d cattle-Agentcattle-system CATTLE-NODE-AGENT-S8S751/1Running112d cattle-agent#-L Filter Those pods with app tag $ kubectl get pods--all-namespaces-l appnamespace NAME ready STATUS restarts Agecattle-alerting alertmanager-649c5fc4d7-4hp9q2/2Running01dcattle-system CATTLE-CLUSTER-AGENT-6D7C847588-F6CMT1/1Running228dcattle-system Cattle-node-agent-9m2ls1/1Running228dcattle-system CATTLE-NODE-AGENT-9NGFH1/1Running012d# hit label $ kubectl label pod JDK-94bcfc779-fs2cl app=dev# Modifying Labels--overwrite$ kubectl label pod JDK-94bcfc779-fs2cl app=test--overwrite

Tag Selector

    • Equivalent relationship Tag Selector: =, = =,! = (Kubectl get pods-l App=test,app=dev)
    • Collection Relationship Tag Selector: Key in (V1,V2,V3), key notin (V1,V2,V3)! KEY (Kubectl get Pods-l "app in (Test,dev)")

Many resources support inline fields

    • Matchlabels: Directly given a built-in value
    • Matchexpressions: Defines the use of a tag selector based on the given expression {key: "key", Operator: "operator", Values:[v1,v2,....]}
    • Operator: The value of the in notin:values field must be a non-empty list Exists The value of notexists:values field must be an empty list

Node Selector

Nodeselector <object>

Annotations to annotations resources in meta-data

Annotations <object> Unlike labels, he cannot pick a resource object, only to provide metadata for the object

Pod Controller of Kubernetes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.