Kubenete study notes (POD)

2021-04-09 15:26

阅读:736

标签:sage   write   spl   value   hat   des   ecif   sed   file   

Pod Definition:

Create pod by definition: kubectl create -f [filename]
Display pod definition: kubectl get po [pod name] -o yaml/json
Getting log: kubectl logs [pod name] -c [container name]

Port forwarding: kubectl port-forward [pod name] [localport]:[pod port]
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/image specify container image to use in pod
Spec/containers/port is just for information:

Labels:
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

Annotation:
Used to introduce new features in kubenete

Namespace:
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

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


评论


亲,登录后才可以留言!