Kubenete study notes (POD)
2021-04-09 15:26
标签:sage write spl value hat des ecif sed file Create pod by definition: kubectl create -f [filename] Port forwarding: kubectl port-forward [pod name] [localport]:[pod port] Spec/containers/image specify container image to use in pod Labels: Annotation: Namespace: Pod failure can be recovered by kubelet while node failure needs to be recovered by replicationController Kubenete study notes (POD) 标签:sage write spl value hat des ecif sed file 原文地址:https://blog.51cto.com/shadowisper/2476295
Display pod definition: kubectl get po [pod name] -o yaml/json
Getting log: kubectl logs [pod name] -c [container name]
Delete pod:
kubectl delete po [pod name]
kubectl delete po -l [label name=value]
kubectl delete ns deletes all pods in a namespace
kubectl delete po --all -n [namespace]
Spec/containers/port is just for information:
App: which specifies which app, component, or microservice the pod belongs to.
Rel: which shows whether the application running in the pod is a stable, beta,
or a canary release.
Attach label:
kubectl label po [pod name] [label name=value] --overwrite
kubectl label node [node name] [label name=value] --overwrite
Label selector: kubectl get po -l [label selector]
Use label selector to schedule pod so that it satisfy different hardware requirements
Schedule pod to a set of nodes: Use nodeSelector in pod definition: Spec/nodeSelector/
Schedule pod to specific node: Set nodeSelector to kubernetes.io/hostname=xxx
Used to introduce new features in kubenete
Resource names only need to be unique within a namespace. Two different namespaces can contain resources of the same name. Can be used to implement multi-tenancy
Namespace can be used to limit resource usage and access right
Node is not tied to namespace.
kubectl create -f [yaml file name] namespace [xxx] to create pod that ties to a specific namespace
上一篇:CSS3 过渡