微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

云计算_K8s-通过命令来学习

前置命令查看

   kind get cluseters
   kind get nodes
   helm list
   
  k8s control plane(kube-apiserver, kube-schedudler and kube-controller-manager) 

基本情况查看确认

kubectl cluster-info
kubectl get node
kubectl get namespaces 
kubectl get cs
    componentStatus
	   This API prevIoUsly provided status of etcd, kube-scheduler, and kube-controller-manager components
	   替换
	      etcd health
		  kube-apiserver health check 
		  kube-scheduler/kube-controller-manager health checks
		  
		  made directly against those components’ health endpoints
		  3 API endpoints (healthz, livez and readyz)
		  
		  kubectl get --raw='/readyz?verbose'
		  curl -k  https://localhost:6443/livez?verbose
		  curl -k 'https://localhost:6443/readyz?verbose&exclude=etcd'
		  状态码 200 表示 API 服务器是 healthy、live 还是 ready

资源类型

kube-apiserver   
  kubectl api-resources
  kubectl explain  $resource_name
  
  查看指定的api:
   kubectl get apiservice  $resource_name
  访问api
    kubectl get --raw=	  

查看具体的类型

 知道 Pod 内部应用程序发生的事		 
 kubectl get pods -A
 kubectl describe pods 
 
  kubectl get service	 

查看日志和进入Pod内部

 kubectl logs    Pod 的日志无法定位问题
 Kubectl exec    exec 命令在容器中直接对应用程序进行故障排除
 
 # 1.在k8s查看安装好的etcd
   kubectl get pod -n kube-system | grep etcd
 #  2.进入k8s的etcd
   kubectl exec -ti etcd-s205 -n kube-system   /bin/bash

查看配置文件

  /etc/kubernetes/scheduler.conf 
  /etc/kubernetes/controller-manager.conf

  
  V1 componentstatus is deprecated in v1.19+

参考

 https://www.suse.com/c/whats-new-in-kubernetes-1-19/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐