In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-09 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Environment description:
Hostname operating system version ipdocker versionkubelet version configuration remarks masterCentos 7.6.1810172.27.9.131Docker 18.09.6V1.14.22C2Gmaster host node01Centos 7.6.1810172.27.9.135Docker 18.09.6V1.14.22C2Gnode node node02Centos 7.6.1810172.27.9.136Docker 18.09.6V1.14.22C2Gnode node
For more information on k8s cluster deployment, please see Centos7.6 deployment k8s (v1.14.2) cluster.
For more information on K8s learning materials, see: basic concepts, kubectl commands and data sharing.
For more information on k8s high availability cluster deployment, please see Centos7.6 deployment k8s v1.16.4 high availability cluster (active / standby mode)
1. K8s core components
Kubernetes mainly consists of the following core components:
Etcd keeps the state of the entire cluster; apiserver provides the only entry for resource operation and provides mechanisms such as authentication, authorization, access control, API registration and discovery; controller manager is responsible for maintaining the state of the cluster, such as fault detection, automatic extension, rolling updates, etc. Scheduler is responsible for resource scheduling, dispatching Pod to the corresponding machines according to the predetermined scheduling policy Kubelet is responsible for maintaining the life cycle of the container, and is also responsible for the management of Volume (CVI) and network (CNI). Container runtime is responsible for image management and the real operation of Pod and container (CRI). Kube-proxy is responsible for providing Service with service discovery and load balancing within cluster. II. Introduction to kubectl
Kubectl is the command line tool (CLI) of Kubernetes and is a necessary management for Kubernetes users and administrators.
Tools. The kubectl tool controls the Kubernetes cluster manager. It allows you to check cluster resources, create, delete, and update groups
Pieces and more functions. Kubectl provides a large number of subcommands to facilitate the management of various functions in the Kubernetes cluster.
1.kubectl use kubectl-h View subcommand list kubectl options to view global options kubectl-- help View subcommand help kubectl [command] [PARAMS]-o = set output format (such as json, yaml, jsonpath, etc.) kubectl explain [RESOURCE] View Resource definition 2.kubectl plug-in krew
Krew is a tool for managing kubectl plug-ins, similar to apt or yum, that supports searching, installing, and managing kubectl plug-ins.
Third, krew installation 1.git installation [root@master] # yum-y install git2. Install krew set-x; cd "$(mktemp-d)" & & curl-fsSLO "https://github.com/kubernetes-sigs/krew/releases/download/v0.3.2/krew.{tar.gz,yaml}" & & tar zxvf krew.tar.gz & &. / krew-" $(uname | tr'[: upper:]''[: lower:]') _ amd64 "install\-- manifest=krew.yaml-- archive=krew.tar.gz
Media may not be downloaded due to network reasons, github: https://github.com/loong576/krew-for-kubectl.git has been uploaded
3. Load the environment variable [root@master ~] # export PATH= "${KREW_ROOT:-$HOME/.krew} / bin:$PATH"
The user's environment variable file can be written permanently to avoid invalidation after logout.
4. Installation confirmation [root@master ~] # kubectl plugin list The following compatible plugins are available:/root/.krew/bin/kubectl-krew
Installation completed
4. Krew uses 1. Plug-in index update [root@master ~] # kubectl krew updateUpdated the local copy of plugin index.2. Plug-in search [root@master ~] # kubectl krew search [root@master ~] # kubectl krew search crt
Search all plug-ins and fuzzy search
3. Install the plug-in [root@master ~] # kubectl krew install get-all [root@master ~] # kubectl krew install ns tail
4. Check the installed plug-in [root@master ~] # kubectl krew listPLUGIN VERSIONget-all v1.2.1krew v0.3.2ns v0.7.1tail v0.10.15. View plug-in details [root@master ~] # kubectl krew info nsNAME: nsURI: https://github.com/ahmetb/kubectx/archive/v0.7.1.tar.gzSHA256: 6df4def2caf5a9c291310124098ad6c4c3123936ddd4080b382b9f7930a233ecVERSION: v0.7.1HOMEPAGE: https://github.com/ahmetb/kubectxDESCRIPTION: Also known as "kubens", a utility to set your current namespace and switchbetween them.CAVEATS:\ | If fzf is installed on your machine, you can interactively choose | between the entries using the arrow keys, or by fuzzy searching | as you type. | | See https://github.com/ahmetb/kubectx for customization and details./6. | Plug-in update [root@master ~] # kubectl krew upgrade nsUpdated the local copy of plugin index.F1118 1721 root.go:58 47.271927 81116 root.go:58] failed to upgrade plugin "ns": can't upgrade, the newest version is already installed
Update plug-in ns. Update failed because it is the latest version. You can update all plug-ins by using the command 'kubectl krew upgrade'
7. Use the plug-in-ns [root@master ~] # kubectlkubectl kubectl-get_all kubectl-krew kubectl-ns kubectl-tail [root@master ~] # kubectl ns weave [root@master ~] # kubectl-ns default
After installing the plug-in, you can use the plug-in by calling kubectl or kubectl-. For example, both 'kubectl ns weave'' and 'kubectl-ns default'' can switch default tablespaces.
8. Use the plug-in-get-all [root@master ~] # kubectl-get_all
This command is similar to 'kubectl get all--all-namespaces', but more comprehensive.
9. Use the plugin-- tail [root@master ~] # kubectl-tail [root@master ~] # kubectl-tail-- ns default [root@master ~] # kubectl-tail-- rs kubeapps-8fd98f6f5 [root@master ~] # kubectl-tail-- rs kubeapps/kubeapps-8fd98f6f5
Tail outputs pod logs. The above commands are: output all pod logs, export pod logs of all namespaces default, export all pod logs of all namespaces with replicaset of kubeapps-8fd98f6f5, and output pod logs of namespace kubeapps and replicaset of kubeapps-8fd98f6f5.
10. Uninstall the plug-in [root@master ~] # kubectl krew uninstall tailUninstalled plugin tail
Uninstall the plug-in tail
5. Uninstall krew 1. Check the installation directory rm-rf ~ / .krew [root@master ~] # kubectl krew versionOPTION VALUEGitTag v0.3.2GitCommit bd754e1IndexURI https://github.com/kubernetes-sigs/krew-index.gitBasePath / root/.krewIndexPath / root/.krew/indexInstallPath / root/.krew/storeDownloadPath / tmp/krew-downloadsBinPath / root/.krew/bin2. Uninstall [root@master ~] # rm-rf / root/.krew
All scripts and configuration files in this article have been uploaded: K8s practice (13): kubectl plug-in management tool krew
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.