KUBERNETES03_k8s对象是什么、如何管理、命名空间、代码自动补全提示(五)

本文涉及的产品
容器服务 Serverless 版 ACK Serverless,952元额度 多规格
容器服务 Serverless 版 ACK Serverless,317元额度 多规格
简介: KUBERNETES03_k8s对象是什么、如何管理、命名空间、代码自动补全提示(五)

⑥. 认识kubectl和kubelet


  • ①. 之前的环境中通过kubeadm安装的集群,进入到/etc/kubernetes目录下


微信图片_20220110000344.png


②. kubelet额外参数配置/etc/sysconfig/kubelet。kubelet配置位置/var/lib/kubelet/config.yaml


微信图片_20220110000400.png


③. kubectl的命令大全


[root@k8s-master kubelet]# kubectl
kubectl controls the Kubernetes cluster manager.
 Find more information at: https://kubernetes.io/docs/reference/kubectl/overview/
Basic Commands (Beginner):
  create        Create a resource from a file or from stdin.
  expose        使用 replication controller, service, deployment 或者 pod 并暴露它作为一个 新的 Kubernetes
Service
  run           在集群中运行一个指定的镜像
  set           为 objects 设置一个指定的特征
Basic Commands (Intermediate):
  explain       查看资源的文档
  get           显示一个或更多 resources
  edit          在服务器上编辑一个资源
  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     自动调整一个 Deployment, ReplicaSet, 或者 ReplicationController 的副本数量
Cluster Management Commands:
  certificate   修改 certificate 资源.
  cluster-info  显示集群信息
  top           Display Resource (CPU/Memory/Storage) usage.
  cordon        标记 node 为 unschedulable
  uncordon      标记 node 为 schedulable
  drain         Drain node in preparation for maintenance
  taint         更新一个或者多个 node 上的 taints
Troubleshooting and Debugging Commands:
  describe      显示一个指定 resource 或者 group 的 resources 详情
  logs          输出容器在 pod 中的日志
  attach        Attach 到一个运行中的 container
  exec          在一个 container 中执行一个命令
  port-forward  Forward one or more local ports to a pod
  proxy         运行一个 proxy 到 Kubernetes API server
  cp            复制 files 和 directories 到 containers 和从容器中复制 files 和 directories.
  auth          Inspect authorization
  debug         Create debugging sessions for troubleshooting workloads and nodes
Advanced Commands:
  diff          Diff live version against would-be applied version
  apply         通过文件名或标准输入流(stdin)对资源进行配置
  patch         Update field(s) of a resource
  replace       通过 filename 或者 stdin替换一个资源
  wait          Experimental: Wait for a specific condition on one or many resources.
  kustomize     Build a kustomization target from a directory or a remote url.
Settings Commands:
  label         更新在这个资源上的 labels
  annotate      更新一个资源的注解
  completion    Output shell completion code for the specified shell (bash or zsh)
Other Commands:
  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        修改 kubeconfig 文件
  plugin        Provides utilities for interacting with plugins.
  version       输出 client 和 server 的版本信息
Usage:
  kubectl [flags] [options]
Use "kubectl <command> --help" for more information about a given command.
Use "kubectl options" for a list of global command-line options (applies to all commands).


⑦. k8s的自动补全



  • ②. 详细步骤


# 安装 
yum install bash-completion 
# 自动补全 
echo 'source <(kubectl completion bash)' >>~/.bashrc 
kubectl completion bash >/etc/bash_completion.d/kubectl
source /usr/share/bash-completion/bash_completion
相关实践学习
通过Ingress进行灰度发布
本场景您将运行一个简单的应用,部署一个新的应用用于新的发布,并通过Ingress能力实现灰度发布。
容器应用与集群管理
欢迎来到《容器应用与集群管理》课程,本课程是“云原生容器Clouder认证“系列中的第二阶段。课程将向您介绍与容器集群相关的概念和技术,这些概念和技术可以帮助您了解阿里云容器服务ACK/ACK Serverless的使用。同时,本课程也会向您介绍可以采取的工具、方法和可操作步骤,以帮助您了解如何基于容器服务ACK Serverless构建和管理企业级应用。 学习完本课程后,您将能够: 掌握容器集群、容器编排的基本概念 掌握Kubernetes的基础概念及核心思想 掌握阿里云容器服务ACK/ACK Serverless概念及使用方法 基于容器服务ACK Serverless搭建和管理企业级网站应用
相关文章
|
26天前
|
Kubernetes 容器 Perl
【Azure K8S】AKS升级 Kubernetes version 失败问题的分析与解决
【Azure K8S】AKS升级 Kubernetes version 失败问题的分析与解决
|
27天前
|
运维 Kubernetes 监控
在K8S中,Kubernetes常见的部署方式有哪些?
在K8S中,Kubernetes常见的部署方式有哪些?
|
27天前
|
存储 Kubernetes API
在K8S中,Kubernetes的组件有哪些?
在K8S中,Kubernetes的组件有哪些?
|
27天前
|
Kubernetes 负载均衡 开发者
在K8S中,Kubernetes与Docker有什么关系?
在K8S中,Kubernetes与Docker有什么关系?
|
27天前
|
Kubernetes 负载均衡 调度
在K8S中,什么是kubernetes?
在K8S中,什么是kubernetes?
|
27天前
|
Prometheus Kubernetes 监控
在K8S中,如何进行Kubernetes迁移工作?
在K8S中,如何进行Kubernetes迁移工作?
|
1月前
|
存储 Kubernetes 安全
在k8S中,Kubernetes 准入机制是什么?
在k8S中,Kubernetes 准入机制是什么?
|
1月前
|
存储 Kubernetes 容器
Kubernetes(K8S) kubesphere 安装
Kubernetes(K8S) kubesphere 安装
53 4
|
1月前
|
存储 Kubernetes 监控
Kubernetes(K8s)基础与入门指南
【8月更文挑战第15天】Kubernetes作为云原生时代的基石,正在逐步改变软件的开发、部署和管理方式。通过掌握Kubernetes的基础知识和核心功能,开发者可以更加灵活地构建和管理容器化应用。未来,随着技术的不断发展和完善,Kubernetes将在更多领域发挥重要作用,推动云原生技术的普及和应用。
|
1月前
|
存储 Kubernetes API
Kubernetes(K8S) kubesphere 介绍
Kubernetes(K8S) kubesphere 介绍
62 2