博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
电脑如何设置终端设置代理_如何设置一个严肃的Kubernetes终端
阅读量:2520 次
发布时间:2019-05-11

本文共 5541 字,大约阅读时间需要 18 分钟。

电脑如何设置终端设置代理

by Chris Cooney

克里斯·库尼(Chris Cooney)

如何设置一个严肃的Kubernetes终端 (How to set up a serious Kubernetes terminal)

所有k8s书呆子需要的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预先打包了出色的CLI。 对于基本操作,它的运行非常出色。 las,当需要快速执行某项操作时,复杂性就会增加。

The Kubernetes community has built all sorts of web based tooling for monitoring your cluster — , 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社区已经构建了各种基于Web的工具来监视您的集群— , 等。但是,拥有完整的终端设备将Swift加快解决问题根源的时间。 它构成了瑞士军刀的基本组成部分。

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.

以下是我已应用于OSX终端的开源工具的简短列表。 一起使用时,它们使我可以跳过kubernetes集群,快速解决问题并监控行为。 我删除了许多小的实用程序,并坚持使用每天都能使用的工具。

在使用任何工具之前…… (Before any tools…)

Before you go after these tools, I’d strongly recommend installing . 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.

在使用这些工具之前,我强烈建议您安装 。 它是围绕标准OSX终端的出色的开源包装器。 它具有丰富的功能和直观的功能,您可以安装的插件很棒。 列出的其中一些工具假定您已安装ZSH。

()

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.

我开始坚强。 K9s是用于Kubernetes集群的CLI工具的后盾。 您可以通过一次按键直接SSH到pod中,查看日志,删除资源等等。 它为您将执行的最常见操作提供了出色的访问权限。 对于使用kubernetes的任何工程师来说,这都是最重要的。

()

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配置中的各种上下文之间切换。 我们只有一个集群是非常罕见的。 这些之间的切换非常简单

kubectl config use-context my-context

But with this, there are some prerequisites:

但是,这样做有一些先决条件:

  • You need to know the name of the cluster before you run.

    在运行之前,您需要知道集群的名称。
  • There is another, similar set-context command that could trip you up.

    还有另一个类似的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提供了一个更简单的替代方法。 如果您kubectx运行kubectx ,它将在.kube/config文件中列出所有上下文。 然后,您可以提供您感兴趣的上下文的名称:

kubectx my-context

No 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.

无需记住所有上下文,无需手动检查文件,也无需获取错误的命令。 漂亮又简单。 与k9s结合使用k9s ,只需最少的按键k9s ,就可以从CLI进行很多导航。

()

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, (the gentleman who brought you kubectx) also put together kubens. It’s the same as kubectx, only for namespaces.

一旦在上下文中四处游荡,您可能想要挖掘特定的名称空间。 再一次,在集群中拥有多个命名空间是很常见的。 那么, (谁把你的绅士kubectx )也放在一起kubens 。 它与kubectx相同,仅适用于名称空间。

kubens kube-system

Now 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.

现在,默认情况下,所有命令都针对kube-system名称空间运行。 您也可以不带其他任何内容运行kubens来查看名称空间列表。

()

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:

因此,您可以在上下文和名称空间之间切换。 但是,您怎么知道您当前针对的是哪一个呢? 不断检查很痛苦。 目前,要找出答案,您需要运行:

kubenskubectxkubectl 

To remove this, ps1 is a zsh plugin that will automatically show you your current context and namespace:

要删除此问题, ps1是一个zsh插件,它将自动向您显示您当前的上下文和名称空间:

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.

现在,您无需运行任何命令即可查看要指出的名称空间和上下文。 它也是高度可配置的-如果您只对名称空间或上下文之一感兴趣,则可以将其关闭,也可以使用kubeoff完全禁用整个对象。

()

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.

现在,到一些不同的地方。 popeye将对存储库中的资源进行自动扫描,并突出显示明显的明显问题。 这是一个非常新的工具,我发现它非常有用。 如果您要在集群中进行一些Spring大扫除,那么从popeye开始将为您提供一些需要修复的明确指示。

()

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.

曾经使用过kubectl logs吗? 是否注意到您一次只能跟踪一个吊舱中的日志? 好吧,不用担心! Stern是一种工具,可让您基于非常灵活的查询从多个Pod中提取日志。

I’m talking regularly about kubernetes, DevOps and much more on my .

我经常在上谈论kubernetes,DevOps以及更多内容。

翻译自:

电脑如何设置终端设置代理

转载地址:http://shrwd.baihongyu.com/

你可能感兴趣的文章
nginx 高并发配置参数(转载)
查看>>
洛谷 CF937A Olympiad
查看>>
Codeforces Round #445 C. Petya and Catacombs【思维/题意】
查看>>
用MATLAB同时作多幅图
查看>>
python中map的排序以及取出map中取最大最小值
查看>>
ROR 第一章 从零到部署--第一个程序
查看>>
<form>标签
查看>>
vue去掉地址栏# 方法
查看>>
Lambda03 方法引用、类型判断、变量引用
查看>>
was集群下基于接口分布式架构和开发经验谈
查看>>
MySQL学习——MySQL数据库概述与基础
查看>>
ES索引模板
查看>>
HDU2112 HDU Today 最短路+字符串哈希
查看>>
JPanel重绘
查看>>
图片放大器——wpf
查看>>
SCALA STEP BY STEP
查看>>
cocos2d-x学习笔记
查看>>
MySql中的变量定义
查看>>
Ruby数组的操作
查看>>
hdu1181暴搜
查看>>