k8s集群管理

k8s集群管理

集群管理命令

命令说明

子命令 说明
help 用于查看命令及子命令的帮助信息
cluster-info 显示集群的相关配置信息
version 查看服务器及客户端的版本信息
api-resources 查看当前服务器上所有的资源对象
api-versions 查看当前服务器上所有资源对象的版本
config 管理当前节点上kubeconfig 的认证信息
help
 # 查看帮助命令信息
 [root@master ~]# kubectl help version
 Print the client and server version information for the current context.
 ​
 Examples:
   # Print the client and server versions for the current context
   kubectl version
 ... ...
cluster-info
 # 查看集群状态信息
 [root@master ~]# kubectl cluster-info 
 Kubernetes control plane is running at https://192.168.1.50:6443
 CoreDNS is running at https://192.168.1.50:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
 ... ...
version
 # 查看服务端与客户端版本信息
 [root@master ~]# kubectl version
 WARNING: This version information is deprecated and will be replaced with the output from kubectl version --short.  Use --output=yaml|json to get the full version.
 Client Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:58:30Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
 Kustomize Version: v4.5.7
 Server Version: version.Info{Major:"1", Minor:"26", GitVersion:"v1.26.0", GitCommit:"b46a3f887ca979b1a5d14fd39cb1af43e7e5d12d", GitTreeState:"clean", BuildDate:"2022-12-08T19:51:45Z", GoVersion:"go1.19.4", Compiler:"gc", Platform:"linux/amd64"}
api-resources
 # 查看资源对象类型
 [root@master ~]# kubectl api-resources 
 NAME             SHORTNAMES     APIVERSION      NAMESPACED      KIND
 bindings                        v1              true            Binding
 endpoints        ep             v1              true            Endpoints
 events           ev             v1              true            Event
 ... ...
api-versions
 # 查看资源对象版本
 [root@master ~]# kubectl api-versions 
 admissionregistration.k8s.io/v1
 apiextensions.k8s.io/v1
 apiregistration.k8s.io/v1
 apps/v1
 ... ...
config
 # 查看当前认证使用的用户及证书
 [root@master ~]# kubectl config get-contexts 
 CURRENT   NAME                          CLUSTER      AUTHINFO
 *         kubernetes-admin@kubernetes   kubernetes   kubernetes-admin
 # 使用 view 查看详细配置
 [root@master ~]# kubectl config view 
 apiVersion: v1
 clusters:
 - cluster:
     certificate-authority-data: DATA+OMITTED
     server: https://192.168.1.50:6443
   name: kubernetes
 contexts:
 - context:
     cluster: kubernetes
     user: kubernetes-admin
   name: kubernetes-admin&
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值