码迷,mamicode.com
首页 > Web开发 > 详细

Kubenete study notes (POD)

时间:2020-03-08 23:22:12      阅读:89      评论:0      收藏:0      [点我收藏+]

标签: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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!