关于Kubernetes的5件事你可能不知道

By IOD Expert Raphael Do Vale

IOD专家 Raphael Do Vale

Searches for Kubernetes have increased steadily over the years, with more and more people trying to understand exactly what K8s is, and better yet, how they can take advantage of this technology.

多年来,对Kubernetes的搜索一直在稳定增长,越来越多的人试图确切地了解K8是什么,更好的是,他们如何利用这项技术。

So, what is Kubernetes?

那么,什么是Kubernetes?

Simply put, K8s is a container orchestrator platform capable of running different workloads in different environments with great flexibility. It allows an operator to set a minimum and a maximum number of machines for each application and how the app should upgrade. It allows easy deployment with zero downtime and quick recovery.

简而言之,K8s是一个容器协调器平台,能够在不同的环境中以极大的灵活性运行不同的工作负载。 它允许操作员为每个应用程序设置最小和最大计算机数量,以及应用程序应如何升级。 它允许零停机时间和快速恢复的轻松部署。

But not only that. Kubernetes is one of the most popular open-source projects on GitHub and is full of hidden surprises you may not know.

但不仅如此。 Kubernetes是GitHub上 最受欢迎的开源项目之一,充满了您可能不知道的隐藏惊喜。

Let’s uncover some of them.

让我们发现其中的一些。

1. K8可以在一台机器上用于开发目的 (1. K8 Can Be Used on a Single Machine for Development Purposes)

I know… Kubernetes is extremely complex and most people are afraid to even get started with it. It has more than 2000 commits and one new version every three months. Moreover, it’s running in several big companies around the world.

我知道……Kubernetes非常复杂,大多数人甚至害怕开始使用它。 它具有超过2000次提交,每三个月提供一个新版本。 此外,它在世界各地的几家大公司中运行。

Despite all this, it’s actually pretty easy to start with Kubernetes on your local machine with a tool called minikube. The tool is a simplified version of Kubernetes designed for developers and it comes with a basic implementation of a Load Balancer, Persistent Volumes, and even support for NVIDIA GPU!

尽管如此,使用名为minikube的工具在本地计算机上轻松启动Kubernetes实际上非常容易。 该工具是为开发人员设计的Kubernetes的简化版本,它带有负载均衡器Persistent Volumes的基本实现,甚至支持NVIDIA GPU

Minikube supports Windows 8 and up, and can run with VirtualBox or Hyper-v. For an even more straightforward installation process, use Docker for Windows installer. For Linux and macOS, there are also easy installation packages available.

Minikube支持Windows 8及更高版本,并且可以与VirtualBox或Hyper-v一起运行。 对于更直接的安装过程,请使用Docker for Windows安装程序 。 对于LinuxmacOS ,还提供了易于安装的软件包。

2.您可以在Kubernetes上运行无服务器并忘记供应商锁定 (2. You Can Run Serverless on Kubernetes and Forget About Vendor Lock-in)

Is it possible to keep development as quick as possible without worrying about vendor lock-in?

是否有可能使开发尽快进行而不必担心供应商锁定

You aren’t necessarily doomed if you use managed services.

如果使用托管服务,则不一定注定要失败。

Are you willing to take control of your databases and message broker? Remember to have a good backup and upgrade policy to avoid possible problems in the future. But, you aren’t bound to vendor lock-in.

您愿意控制您的数据库和消息代理吗? 请记住要有良好的备份和升级策略,以免将来可能出现问题。 但是,您不必局限于供应商锁定。

Kubernetes can be seen as a Cloud Operating System. It allocates cloud resources in the same structured manner no matter which cloud provider you use. Need a VM? Kubernetes will create one if your cluster needs more resources. Need to horizontally scale an application? K8S will deeply integrate into your cloud provider and create a load balancer for this service. In other words: you can migrate all the ease of provided by your cloud provider to a uniform platform that works with many other cloud providers.

Kubernetes可以看作是云操作系统。 无论您使用哪个云提供商,它都以相同的结构化方式分配云资源。 需要虚拟机吗? 如果您的集群需要更多资源,Kubernetes将创建一个。 是否需要横向扩展应用程序? K8S将深度集成到您的云提供商中,并为此服务创建负载均衡器。 换句话说:您可以将云提供商所提供的所有便利都迁移到可以与许多其他云提供商一起使用的统一平台。

Managed services like databases and message brokers are an attempt by cloud providers to make it easy for you to use one of their exclusive, proprietary services that’s incompatible with other providers. Another trending example is Serverless: every major provider offers its solution (AWS, GCloud, Azure) with a different technology stack and paradigm.

云提供商试图将诸如数据库和消息代理之类的托管服务简化为您使用与其他提供商不兼容的专有专有服务之一。 另一个流行的例子是无服务器:每个主要提供商都以不同的技术堆栈和范例提供其解决方案( AWSGCloudAzure )。

Once you choose one, it may be hard to change to another without changing much of your code. That said, there are open source solutions to deploy the serverless concept on Kubernetes such as Kubeless. Kubeless uses several K8s features to provide Serverless in an open source environment: autoscale, monitoring, and debugging capabilities. It also runs in many different technology stacks. However, native serverless solutions are still more well integrated to other vendor’s cloud services, which can make it easier to develop.

一旦选择了一个代码,可能很难在不更改很多代码的情况下切换到另一个代码。 也就是说,有开源解决方案可以在Kubernetes(例如Kubeless)上部署无服务器概念。 Kubeless使用多种K8s功能在开源环境中提供无服务器:自动缩放,监视和调试功能。 它还可以在许多不同的技术堆栈中运行。 但是,本机无服务器解决方案仍然可以更好地集成到其他供应商的云服务中,这可以使其更易于开发。

3.您可以在K8上设置混合环境 (3. You Can Set Up Hybrid Environments on K8s)

A hybrid environment is when computing resources are divided into cloud and colocation resources sharing the same cluster. Generally, this offers two significant benefits: (1) you will have more resources for peak workloads and, (2) it eases cloud migration by using the company’s current computing resources.

混合环境是指将计算资源分为共享同一群集的云资源和托管资源。 通常,这有两个明显的好处:(1)您将拥有更多的资源来应对高峰工作负载;(2)通过使用公司当前的计算资源来简化云迁移。

Currently in alpha, Kubernetes Cluster Federation (KubeFed) is the K8S solution for this kind of environment. It allows you to have a federation of Kubernetes working together. Each Kubernetes is deployed in a location and communicates with a central location that coordinates all of them. The users then have a centralized API.

Kubernetes集群联盟 (KubeFed)目前处于Alpha中,是针对这种环境的K8S解决方案。 它使您可以将Kubernetes联合在一起工作。 每个Kubernetes都部署在一个位置并与一个协调所有位置的中心位置进行通信。 然后,用户具有集中式API。

Just because it’s available doesn’t mean it’s easy: first, it requires a Kubernetes instance on your on-premises data center. Then, you need to configure Kubefed in both clusters. Keeping a K8s instance is not trivial and should be maintained by qualified professionals to avoid possible production outages. There are dozens of services running that require advanced networking and Unix systems skills.

仅仅因为它可用并不意味着它很简单:首先,它需要在本地数据中心上使用一个Kubernetes实例。 然后,您需要在两个集群中都配置Kubefed。 保留K8s实例并非易事,应由合格的专业人员进行维护,以避免可能的生产中断。 有数十种服务在运行,需要高级联网和Unix系统技能。

Kubefed also can be used to deploy a multi-cloud environment. This could make your life a little bit easier as you do not need to maintain a K8s instance. However, keep in mind possible bandwidth traffic costs depending on your infrastructure topology.

Kubefed还可以用于部署多云环境。 因为您不需要维护K8s实例,这可以使您的生活更轻松一些。 但是,请记住,可能的带宽流量成本取决于您的基础结构拓扑。

4.您可以为有状态应用程序设置永久卷 (4. You Can Set Up Persistent Volumes for Stateful Applications)

We can classify most applications into one of two categories: stateless and stateful. Stateless applications can be shut down anytime without losing sensitive information. Web applications and optimization algorithms are examples. Stateful applications, on the other hand, require persistent storage to store data, such as databases and message brokers.

我们可以将大多数应用程序分为两类之一:无状态和有状态。 无状态应用程序可以随时关闭,而不会丢失敏感信息。 Web应用程序和优化算法就是示例。 另一方面,有状态应用程序需要持久性存储来存储数据,例如数据库和消息代理。

Stateless applications are easy to horizontally scale (increase the number of instances of the same software) as you can turn them on and off without worrying about information stored. Stateful ones, however, need special care to avoid data loss. Horizontally scaled software that relies on storage is specific to the software: some databases support this with its most expensive options (Microsoft SQL Server, Oracle Database). Open source software may have this option with configuration and hard work (PostgreSQL, Redis).

无状态应用程序易于横向扩展(增加同一软件的实例数量),因为您可以打开和关闭它们而不必担心存储的信息。 但是,有状态的需要特别注意以避免数据丢失。 依赖于存储的水平扩展软件特定于该软件:某些数据库以其最昂贵的选项(Microsoft SQL Server,Oracle数据库)支持此功能。 开源软件可以通过配置和辛苦工作来使用此选项( PostgreSQLRedis )。

Persistent Volumes are the K8s solution for handling persistence in applications. There are two types of volumes: static or dynamic. Static volumes are created before the application and are harder to maintain as the operator must know the application needs before creating it. On Dynamic volumes, the cluster allocates the resources when needed. Although dynamic volumes can be used in most cases, a static volume can be used when an application has specific IO needs like a relational database.

持久卷是用于处理应用程序中持久性的K8s解决方案。 卷有两种类型:静态或动态。 静态卷是在应用程序之前创建的,因此难以维护,因为操作员在创建静态卷之前必须知道应用程序的需求。 在动态卷上,群集在需要时分配资源。 尽管在大多数情况下可以使用动态卷,但是当应用程序具有特定的IO需求(例如关系数据库)时,可以使用静态卷。

Persistent volumes use the physical, existent, infrastructure; thus, it depends on providers available. Each cloud provider offers at least one solution for persistence, but there are also third-party solutions.

永久卷使用物理的,现有的基础结构; 因此,这取决于可用的提供程序。 每个云提供商都至少提供一种持久性解决方案,但也有第三方解决方案。

5.您可以使用Windows容器的Windows节点 (5. You Can Work With Windows Node for Windows Containers)

Introduced in Windows Server 2016, Windows containers are now also available for development with Windows 10 (since version 1607). They are like Linux Containers, but able to run Windows applications, even legacy software. They can work like Linux using namespaces and Kernel sharing, or on a more secure workload relying on Hyper-v (isolated Kernel).

Windows容器在Windows Server 2016中引入,现在也可用于Windows 10(自1607版)开发。 它们就像Linux容器一样,但是能够运行Windows应用程序,甚至是旧版软件。 它们可以像使用命名空间和内核共享的Linux一样工作,或在依赖Hyper-v(隔离内核)的更安全的工作负载上工作。

Kubernetes has provided support for Windows containers since Kubernetes 1.14 launched last March. You don’t need to configure anything save for creating a new node pool (with Windows machines). There are some caveats, however: Hyper-v isolation is not available, there are no privileged containers, you can’t mount files (only Volumes), and others.

自去年3月发布Kubernetes 1.14以来,Kubernetes就一直为Windows容器提供支持。 您无需配置任何其他内容即可创建新的节点池(使用Windows计算机)。 但是,有一些注意事项:Hyper-v隔离不可用,没有特权容器,您不能装入文件(仅装入卷),还有其他内容

Kubernetes is vast and still has many secrets. As an open source project, anyone can add new– and sometimes, obscure– features. There are many other elements of K8s that may help you in your particular quest to embrace the container orchestrator. Just take some time, install it on your machine, and play around.

Kubernetes广阔,但仍有许多秘密。 作为一个开源项目,任何人都可以添加新的(有时是晦涩的)功能。 K8的许多其他元素可以在您寻求容器协调器的特定任务中帮助您。 只需花一些时间,将其安装在您的计算机上,然后玩一下。

This article was originally featured on the weekly tech blog at IOD. If you’re a tech professional interested in learning more or sharing knowledge about cloud, devops, AI, serverless, and other related topics, check out our latest content over there.

本文最初刊登 在IOD 每周技术博客上 如果您是技术专家,想了解更多信息或分享有关云,devops,AI,无服务器和其他相关主题的知识,请查看那里的 最新内容

翻译自: https://medium.com/@IODCloudTech/5-things-you-may-not-know-about-kubernetes-4194bad6de76

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值