电脑如何设置终端设置代理_如何设置一个严肃的Kubernetes终端
電腦如何設(shè)置終端設(shè)置代理
by Chris Cooney
克里斯·庫(kù)尼(Chris Cooney)
如何設(shè)置一個(gè)嚴(yán)肅的Kubernetes終端 (How to set up a serious Kubernetes terminal)
所有k8s書(shū)呆子需要的CLI工具 (All the CLI tools a growing k8s nerd needs)
Kubernetes comes pre-packaged with an outstanding CLI. For basic operations, it works wonderfully. Alas, when one needs to do something quickly, complexity increases.
Kubernetes預(yù)先打包了出色的CLI。 對(duì)于基本操作,它的運(yùn)行非常出色。 las,當(dāng)需要快速執(zhí)行某項(xiàng)操作時(shí),復(fù)雜性就會(huì)增加。
The Kubernetes community has built all sorts of web based tooling for monitoring your cluster — kube ops view, grafana etc. However, having a fully kitted terminal will rapidly speed up the time it takes to get to the root of an issue. It forms a fundamental part of your Swiss army knife.
Kubernetes社區(qū)已經(jīng)構(gòu)建了各種基于Web的工具來(lái)監(jiān)視您的集群— kube ops view , grafana等。但是,擁有完整的終端設(shè)備將Swift加快解決問(wèn)題根源的時(shí)間。 它構(gòu)成了瑞士軍刀的基本組成部分。
The following is a very short list of open source tools that I’ve applied to my OSX terminal. When used together, they allow me to skip around my kubernetes cluster, quickly troubleshoot issues, and monitor behaviour. I’ve cut out lots of small little utilities and stuck to the tools that I find myself using every day.
以下是我已應(yīng)用于OSX終端的開(kāi)源工具的簡(jiǎn)短列表。 一起使用時(shí),它們使我可以跳過(guò)kubernetes集群,快速解決問(wèn)題并監(jiān)控行為。 我刪除了許多小的實(shí)用程序,并堅(jiān)持使用每天都能使用的工具。
在使用任何工具之前…… (Before any tools…)
Before you go after these tools, I’d strongly recommend installing zsh. It is an outstanding, open source wrapper around the standard OSX terminal. It is more feature rich and intuitive and the plugins you can install are fantastic. Some of these tools listed make the assumption you have ZSH installed.
在使用這些工具之前,我強(qiáng)烈建議您安裝zsh 。 它是圍繞標(biāo)準(zhǔn)OSX終端的出色的開(kāi)源包裝器。 它具有豐富的功能和直觀的功能,您可以安裝的插件很棒。 列出的其中一些工具假定您已安裝ZSH。
9秒 (k9s)
I’m starting strong. K9s is the momma bear of CLI tools for kubernetes cluster. You can SSH straight into pods with a single key press, view logs, delete resources and more. It provides outstanding access for the most common operations you’ll be performing. This is a staple for any engineer using kubernetes.
我開(kāi)始堅(jiān)強(qiáng)。 K9s是用于Kubernetes集群的CLI工具的后盾。 您可以通過(guò)一次按鍵直接SSH到pod中,查看日志,刪除資源等等。 它為您將執(zhí)行的最常見(jiàn)操作提供了出色的訪問(wèn)權(quán)限。 對(duì)于使用kubernetes的任何工程師來(lái)說(shuō),這都是最重要的。
kubectx (kubectx)
But one thing that K9s doesn’t support is switching between various contexts in your kubernetes config. It is very rare that we’ll only have one single cluster. Switching between these is as simple as
但是K9s不支持的一件事是在kubernetes配置中的各種上下文之間切換。 我們只有一個(gè)集群是非常罕見(jiàn)的。 這些之間的切換非常簡(jiǎn)單
kubectl config use-context my-contextBut with this, there are some prerequisites:
但是,這樣做有一些先決條件:
- You need to know the name of the cluster before you run. 在運(yùn)行之前,您需要知道集群的名稱。
There is another, similar set-context command that could trip you up.
還有另一個(gè)類似的set-context命令可以使您崩潰。
kubectx presents a simpler alternative to this. If you run kubectx on its own, it will list out all of the contexts in your .kube/config file. You can then provide the name of the context you’re interested in:
kubectx提供了一個(gè)更簡(jiǎn)單的替代方法。 如果您kubectx運(yùn)行kubectx ,它將在.kube/config文件中列出所有上下文。 然后,您可以提供您感興趣的上下文的名稱:
kubectx my-contextNo need to remember all the contexts, no need to manually check files and no possibility of getting the wrong command. Nice and simple. Combined with k9s, this offers a lot of navigability from your CLI with minimal key presses.
無(wú)需記住所有上下文,無(wú)需手動(dòng)檢查文件,也無(wú)需獲取錯(cuò)誤的命令。 漂亮又簡(jiǎn)單。 與k9s結(jié)合使用k9s ,只需最少的按鍵k9s ,就可以從CLI進(jìn)行很多導(dǎo)航。
庫(kù)本斯 (kubens)
Once you’re flitting around contexts, you may want to dig into a specific namespace. Once again, it’s very common to have more than a few namespaces in your cluster. Well, ahmetb (the gentleman who brought you kubectx) also put together kubens. It’s the same as kubectx, only for namespaces.
一旦在上下文中四處游蕩,您可能想要挖掘特定的名稱空間。 再一次,在集群中擁有多個(gè)命名空間是很常見(jiàn)的。 那么, ahmetb (誰(shuí)把你的紳士kubectx )也放在一起kubens 。 它與kubectx相同,僅適用于名稱空間。
kubens kube-systemNow all of your commands run against the kube-system namespace, by default. You can also run kubens without anything else to see a list of your namespaces.
現(xiàn)在,默認(rèn)情況下,所有命令都針對(duì)kube-system名稱空間運(yùn)行。 您也可以不帶其他任何內(nèi)容運(yùn)行kubens來(lái)查看名稱空間列表。
kube-ps1 (kube-ps1)
So, you can switch between contexts and namespaces. But how do you know which one you’re currently aimed at? It’s a pain to keep checking. At the moment, to find out you’d need to run:
因此,您可以在上下文和名稱空間之間切換。 但是,您怎么知道您當(dāng)前針對(duì)的是哪一個(gè)呢? 不斷檢查很痛苦。 目前,要找出答案,您需要運(yùn)行:
kubens kubectx kubectl <my-command>To remove this, ps1 is a zsh plugin that will automatically show you your current context and namespace:
要?jiǎng)h除此問(wèn)題, ps1是一個(gè)zsh插件,它將自動(dòng)向您顯示您當(dāng)前的上下文和名稱空間:
Now you can see which namespace and context you’re pointing out without running a single command. It’s also highly configurable too — you can turn off namespace or context, if you’re only interested in one of them, or you can use kubeoff to disable the whole thing entirely.
現(xiàn)在,您無(wú)需運(yùn)行任何命令即可查看要指出的名稱空間和上下文。 它也是高度可配置的-如果您只對(duì)名稱空間或上下文之一感興趣,則可以將其關(guān)閉,也可以使用kubeoff完全禁用整個(gè)對(duì)象。
大力水手 (popeye)
Now, onto something a little different. popeye will run automatic scans of the resources in your repository and highlight clear, obvious problems. This is a very new tool and one that I have found very useful. If you’re looking for some spring cleaning to do in your cluster, starting with popeye will give you some clear indications of what needs to be fixed.
現(xiàn)在,到一些不同的地方。 popeye將對(duì)存儲(chǔ)庫(kù)中的資源進(jìn)行自動(dòng)掃描,并突出顯示明顯的明顯問(wèn)題。 這是一個(gè)非常新的工具,我發(fā)現(xiàn)它非常有用。 如果您要在集群中進(jìn)行一些Spring大掃除,那么從popeye開(kāi)始將為您提供一些需要修復(fù)的明確指示。
船尾 (Stern)
Ever used kubectl logs? Noticed you can only follow logs from one pod at one time? Well, worry no more! Stern is a tool that allows you to pull the logs from multiple pods, based on a very flexible query.
曾經(jīng)使用過(guò)kubectl logs嗎? 是否注意到您一次只能跟蹤一個(gè)吊艙中的日志? 好吧,不用擔(dān)心! Stern是一種工具,可讓您基于非常靈活的查詢從多個(gè)Pod中提取日志。
I’m talking regularly about kubernetes, DevOps and much more on my twitter account.
我經(jīng)常在Twitter帳戶上談?wù)搆ubernetes,DevOps以及更多內(nèi)容。
翻譯自: https://www.freecodecamp.org/news/how-to-set-up-a-serious-kubernetes-terminal-dd07cab51cd4/
電腦如何設(shè)置終端設(shè)置代理
總結(jié)
以上是生活随笔為你收集整理的电脑如何设置终端设置代理_如何设置一个严肃的Kubernetes终端的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 梦到打煤球啥意思
- 下一篇: 心学 禅宗_禅宗宣言,用于有效的代码审查