共计 2717 个字符,预计需要花费 7 分钟才能阅读完成。
一. 什么是 k8s:
全名 kubenetes,容器编排工具,分布式的架构,可能对 docker 以及其余容器进行主动部署,弹性伸缩和治理
二.k8s 的架构:
分布式的,一个 master 节点(属于是主节点)和多个 node 节点(计算节点),master 就是领导不干理论的计算工作而是负责整体把关,node 属于就是 worker 节点,承受指令干活的。
1、master 节点包含五个大部分:
(1)kubectl:在 cmd 命令行操作指令的都是这个,属于是输出 kubectl 命令的入口
都有啥命令呢:
第一个命令
kubectl --help
而后就会显示都有啥命令如下:Basic Commands (Beginner):
create Create a resource from a file or from stdin.
expose Take a replication controller, service, deployment or pod and expose it as a new Kubernetes Service
run Run a particular image on the cluster
set Set specific features on objects
Basic Commands (Intermediate):
explain Documentation of resources
get Display one or many resources
edit Edit a resource on the server
delete Delete resources by filenames, stdin, resources and names, or by resources and label selector
Deploy Commands:
rollout Manage the rollout of a resource
scale Set a new size for a Deployment, ReplicaSet or Replication Controller
autoscale Auto-scale a Deployment, ReplicaSet, or ReplicationController
Cluster Management Commands:
certificate Modify certificate resources.
cluster-info Display cluster info
top Display Resource (CPU/Memory/Storage) usage.
cordon Mark node as unschedulable
uncordon Mark node as schedulable
drain Drain node in preparation for maintenance
taint Update the taints on one or more nodes
Troubleshooting and Debugging Commands:
describe Show details of a specific resource or group of resources
logs Print the logs for a container in a pod
attach Attach to a running container
exec Execute a command in a container
port-forward Forward one or more local ports to a pod
proxy Run a proxy to the Kubernetes API server
cp Copy files and directories to and from containers.
auth Inspect authorization
Advanced Commands:
diff Diff live version against would-be applied version
apply Apply a configuration to a resource by filename or stdin
patch Update field(s) of a resource using strategic merge patch
replace Replace a resource by filename or stdin
wait Experimental: Wait for a specific condition on one or many resources.
convert Convert config files between different API versions
kustomize Build a kustomization target from a directory or a remote url.
Settings Commands:
label Update the labels on a resource
annotate Update the annotations on a resource
completion Output shell completion code for the specified shell (bash or zsh)
Other Commands:
alpha Commands for features in alpha
api-resources Print the supported API resources on the server
api-versions Print the supported API versions on the server, in the form of "group/version"
config Modify kubeconfig files
plugin Provides utilities for interacting with plugins.
version Print the client and server version information
一样一样来,先看最简略的 ——- 比方查看的命令:
1.1 查问集群中的所有 namespace
kubectl get namespaces
1.2 查看所有 pod
kubectl get po -A
(2)Api-Server:简洁的说就是 外部内部都是它交互,具备验证和受权,只有它能和 etcd 交互,属于是 matser 的🧠大脑
如果 master 是领导,那么 apiserver 就是老板的大脑,这个属于是 k8s 裸露给内部接口的组件,只有它能和 etcd 组件交互,所有对于资源的操作,全副通过它来调配,也能够了解为,依据这个名字,这个 k8s 属于一个 server,而后客户端想操作 k8s 这个 server 就是 http 去调用接口么,后续逻辑就是外部解决了,而后 Api-Server 有很多机制包含:认证、受权、访问控制、api 注册、发现
(3)controller-manager:k8s 集群外部的所有 controller 的管理员,
正文完
发表至: kubernetes
2022-08-11