我为什么要关心Kubernetes,Docker和Container Orchestration?

2023-12-02 15:10

本文主要是介绍我为什么要关心Kubernetes,Docker和Container Orchestration?,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

A person at work chatted me, commenting on my recent blog posts on the Raspberry Pi Kubernetes Clusters that are being built, and wondered "why should I care about Kubernetes or Docker or any of that stuff?"

一个工作人员与我聊天,评论了我最近在构建的Raspberry Pi Kubernetes集群上的博客文章,并想知道“为什么我应该关心Kubernetes或Docker或其中的任何东西?”

WOCinTech Chat pic used under CC

Great question, and I'm figuring it out myself. There are lots of resources out there but none that spoke my language, so here's my thoughts and how I explain it.

很好的问题,我自己弄清楚。 那里有很多资源,但是没有一种能说我的语言,所以这是我的想法以及我的解释方式。

"Hey, I have this great new blog app!"

“嘿,我有这个很棒的新博客应用!”

"Fab, gimme!"

“ Fab,吉米!”

"Sure, first make sure you have this version of Windows/Linux, this version of .NET/Python/Node, and these prerequisites."

“当然,首先请确保您具有此版本的Windows / Linux,此版本的.NET / Python / Node以及这些先决条件。”

"Hang on, lemme call you next week when that's handled."

“等一下,lemme下周打给你。”

This is how software was built for years. Now let's deploy it.

这就是多年来构建软件的方式。 现在让我们部署它。

"Here's the code/dlls/application zipped up."

“这是压缩的代码/ dll /应用程序。”

"Lemme FTP/SFTP/Drag this from one Explorer Window to another."

“使FTP / SFTP /将其从一个资源管理器窗口拖动到另一个资源管理器窗口。”

"Is this version of that file set to this?"

“该文件的这个版本设置为此吗?”

"Wait, what?"

“等等,什么?”

"Make sure that system/boss/dll/nounjs is version 4.5.4.1, they patched it."

“确保system / boss / dll / nounjs版本为4.5.4.1,他们对此进行了修补。”

"Ok, Imma shush* into production."

“好吧,伊玛(Imma)将*投入生产。”

Again, we've all been there. It's 2018 and there's more folks doing this than you care to admit.

再一次,我们都去过那里。 现在是2018年,这样做的人比你所想承认的要多。

Enter Virtual Machines! Way better, right? Here's a USB key with a  file that is EVERYTHING you need. Handled.

输入虚拟机! 更好一点吧? 这是USB密钥,其中包含您所需的所有文件。 处理。

"Forget that, use this. It's better than a computer, it's a Virtual Machine. But be aware, It doesn't know it's Virtual, so respect the lie."

“算了,用这个吧。它比计算机要好,它是虚拟机。但是要知道,它不知道它是虚拟的,所以请撒谎。”

"OK, email it to me."

“好的,用电子邮件发送给我。”

"Well, it's 32 gigs. Lemme UPS it."

“好吧,那是32场演出。LemmeUPS。”

Your app is only 100 megs, and this VM is tens of gigs. Why does a 150 pound person need a 6000lb Hummer? Isolation, I guess.

您的应用程序只有100兆,而这个虚拟机则是数十兆。 为什么150磅重的人需要6000磅悍马? 我想是隔离的。

"The app is getting more complex, but it's cool. There's four VMs now. One for the DB, one for Redis, and a front end one, and the shopping cart gets one. It's microservices!"

“应用程序变得越来越复杂,但是它很酷。现在有四个VM。一个用于DB,一个用于Redis,一个前端,购物车得到一个。这是微服务!”

"I'm loving it."

“我喜欢这个。”

"Here's a 2 TB drive."

“这是一个2 TB的驱动器。”

Nice that we're breaking it up, but not so nice that we're getting bloated. Now we have to run apt upgrade/windows update on all these things and maintain them. Why drive a Hummer when I can get a Lyft?

很好,我们正在分解它,但是不太好,我们变得肿。 现在,我们必须对所有这些东西运行apt upgrade / windows update并进行维护。 当我能拿到Lyft时,为什么要开悍马?

"Ok I got them all running on this beefy machine under my desk."

“好吧,我让它们都在我桌子下面的那台强大的机器上运行。”

"Cool, we're moving to the cloud."

“很酷,我们正在迁移到云上。”

"Sigh. I need to update all these connection strings and start uploading VMs."

“抱歉。我需要更新所有这些连接字符串并开始上传VM。”

"It'll be great. It's like a machine under your desk, except your desk is in the cloud."

“那太好了。它就像桌子底下的一台机器,除了桌子在云端。”

"What's the cloud?"

“什么是云?”

"It's a server room you can't see. Basically it's the computers under your desk. But invisible."

“这是您看不到的服务器机房。基本上是您桌子下面的计算机。但看不见。”

Most VM infrastructure is pretty sloppy. It's hard coded IP addresses, it's poorly named VMs living in the same subnets, then we'll move them to the cloud (lift and shift!) but then they are still messy, but they're in the Cloud™, right?

大多数虚拟机基础架构都很草率。 它是硬编码的IP地址,它是一个名字不佳的VM,它们生活在同一子网中,然后我们将它们移动到云中(抬起并移动!),但是它们仍然很混乱,但是它们在Cloud™中,对吗?

"You know, all these VMs are heavy. I have to maintain and move a bunch of stuff that ISN'T the app. Containers are the way. Just define the app's base requirement and share everything else."

“您知道,所有这些VM都很沉重。我必须维护和移动一堆不是该应用程序的东西。容器是一种方式。只需定义应用程序的基本要求并共享其他所有内容。”

"I've been hearing about this. I can type "docker run hello-world" and on any machine it'll load the hello world image (based on Ubuntu) from a central hub and run it in a mostly isolated way. Guaranteed to work and run, even as time passes."

“我已经听说过。我可以键入“ docker run hello-world”,并且可以在任何计算机上从中央集线器加载hello world映像(基于Ubuntu),并以一种隔离的方式运行它。工作和运行,即使时间流逝。”

"Nice, because more and more parts of our app are in .NET Core on Linux, but there's also some Python and node."

“很好,因为我们应用程序的越来越多的部分位于Linux上的.NET Core中,但是也有一些Python和节点。”

"Yep and it'll all just run as the prerequisites are clearly listed in the container...and the prereqs are in fact references to other container images."

“是的,所有这些都将在容器中清楚列出先决条件……而前提条件实际上是对其他容器映像的引用。”

"It's containers all the way down."

“这是一路下跌的集装箱。”

Now the DB, Redis, the front end, and the shopping cart can call be defined in some simple text files. Rather than your Host OS (the main computer...the metal) loading up a bunch of Guest OS's (literally copies!) and then loading all the apps and prerequisites, you'll share  OSes, and when appropriate, the binaries and libraries.

现在,可以在一些简单的文本文件中定义数据库,Redis,前端和购物车。 您将共享操作系统,并在适当时共享二进制文件和库,而不是主机OS(主机...金属)加载一堆Guest OS(字面意思!),然后加载所有应用程序和必备软件。 。

"OK, now we have a bunch of containers running in Docker, but sometimes they go down or stop."

“好的,现在我们有一堆容器正在Docker中运行,但有时它们会掉下来或停下来。”

"Run them again?"

“再次运行它们?”

"It's more that that, we need to sometimes have 3 shopping cart containers, and other times we need 2 or more DB containers. Plus their IPs sometimes change"

“不仅如此,有时我们需要3个购物车容器,而有时我们需要2个或更多DB容器。此外,它们的IP有时会改变”

"So we need something to keep them running, scale or auto-scale them, as well manage networking and naming/dns."

“因此,我们需要一些东西来保持它们的运行,扩展或自动扩展,以及管理网络和命名/ dns。”

Enter a container orchestrator. There's Docker Swarm, Mesos/Marathon, Azure Service Fabric, and others, but for this post we'll use Kubernetes.

输入一个容器协调器。 有Docker Swarm,Mesos / Marathon,Azure Service Fabric等,但是在这篇文章中,我们将使用Kubernetes。

"So Kubernetes runs my containers, keeps them running, and helps manage the network?"

“那么Kubernetes可以运行我的容器,使其保持运行状态,并有助于管理网络?”

"Yes, and no. Parts of Kubernetes - or k8s, as cool people like me who have been using it for nearly 3 hours say - are part of the master components, like etcd for key value storage, and the kube-scheduler for selecting what node to run a "pod" on (a pod is cooler to say than container, but sometimes a pod is more than one container. Still, very cool.)

“是的,不是。Kubernetes的一部分,或者像我这样酷的人,使用了将近3个小时的k8,都是主要组件的一部分,例如etcd用于存储键值,以及kube计划程序用于选择在哪个节点上运行“ pod”(pod比容器说的要凉爽,但有时pod不仅仅是一个容器。仍然非常酷。)

"I'll need to make a glossary."

“我需要做一个词汇表。”

"Darn tootin' you will."

“你该死的。”

Kubernetes has basically pluggable everything. Don't like their networking setup? There's literally over a dozen options. Want better charts and graphs? Whole world of options.

Kubernetes基本上可以插入所有内容。 不喜欢他们的网络设置? 实际上有十几种选择。 需要更好的图表吗? 选择的整个世界。

Just as one Dockerfile can explain declare what's needed to run an app, a Kubernetes YAML file describes not only the containers, but the ports needed, the number of replicas of each (think web farm), names, environment variables, and more. Here's a file that shows a front end, back end, and load balancer. Everything is there, connection strings become internal DNS lookups, every service has a load balancer (if you like), and you can scale manually or auto-scale.

正如一个Dockerfile可以 解释 声明运行某个应用程序所需的内容一样,Kubernetes YAML文件不仅描述了容器,还描述了所需的端口,每个副本的数量(例如Web场),名称,环境变量等。 这是一个显示前端,后端和负载均衡器的文件。 一切都在那里,连接字符串成为内部DNS查找,每个服务都有一个负载平衡器(如果您愿意),您可以手动扩展或自动扩展。

"Ok so why should I care?"

“好,那我为什么要关心呢?”

"A few reasons. In the past, to install our app I'd need to give you a Word document and a weekend. Now you type kubectl apply theapp.yaml and it's running in less than a minute."

“有几个原因。过去,要安装我们的应用程序,我需要给您一个Word文档和一个周末。现在,您键入kubectl apply theapp.yaml ,它会在不到一分钟的时间内运行。”

"I'm still billing for the weekend."

“我仍在为周末开票。”

Simply stated, we are at the beginning of a new phase of DevOps. One that is programmatic, elastic, and declarative. It's consistent and clear and modular.

简而言之,我们正处于DevOps新阶段的开始。 它是程序化,弹性化和声明式的。 它是一致,清晰和模块化的。

I recommend you check out Julia Evans' "Reasons Kubernetes is cool" as well as reading up on how to make a Kubernetes cluster (and the management VMS are free) in Azure.

我建议您阅读Julia Evans的“ Reasons Kubernetes很棒” ,并阅读有关如何在Azure中制作Kubernetes集群(并且管理VMS是免费的)的信息。

* I'm trying to make shush a thing. We don't Es Es Eaytch into machines! We shush in! It's pronounced somewhere between shush and shoosh. Make sure you throw in a little petit jeté when you say it.

我正在努力使事情变得安静。 我们不把Es Es Eaytch变成机器! 我们嘘! 它的发音介于嘘声和嘘声之间。 说出它时,请确保丢上一条小小的杰特。

* Pic used under CC

*图片在CC下使用

Sponsor: Unleash a faster Python Supercharge your applications performance on future forward Intel® platforms with The Intel® Distribution for Python. Available for Windows, Linux, and macOS. Get the Intel® Distribution for Python* Now!

赞助商:释放更快的Python借助适用于Python的英特尔®发行版,在未来的未来英特尔®平台上增强您的应用程序性能。 适用于Windows,Linux和macOS。 立即获取适用于Python *的英特尔®发行版!

翻译自: https://www.hanselman.com/blog/why-should-i-care-about-kubernetes-docker-and-container-orchestration

这篇关于我为什么要关心Kubernetes,Docker和Container Orchestration?的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/445797

相关文章

如何用Docker运行Django项目

本章教程,介绍如何用Docker创建一个Django,并运行能够访问。 一、拉取镜像 这里我们使用python3.11版本的docker镜像 docker pull python:3.11 二、运行容器 这里我们将容器内部的8080端口,映射到宿主机的80端口上。 docker run -itd --name python311 -p

Kubernetes PodSecurityPolicy:PSP能实现的5种主要安全策略

Kubernetes PodSecurityPolicy:PSP能实现的5种主要安全策略 1. 特权模式限制2. 宿主机资源隔离3. 用户和组管理4. 权限提升控制5. SELinux配置 💖The Begin💖点点关注,收藏不迷路💖 Kubernetes的PodSecurityPolicy(PSP)是一个关键的安全特性,它在Pod创建之前实施安全策略,确保P

K8S(Kubernetes)开源的容器编排平台安装步骤详解

K8S(Kubernetes)是一个开源的容器编排平台,用于自动化部署、扩展和管理容器化应用程序。以下是K8S容器编排平台的安装步骤、使用方式及特点的概述: 安装步骤: 安装Docker:K8S需要基于Docker来运行容器化应用程序。首先要在所有节点上安装Docker引擎。 安装Kubernetes Master:在集群中选择一台主机作为Master节点,安装K8S的控制平面组件,如AP

什么是Kubernetes PodSecurityPolicy?

@TOC 💖The Begin💖点点关注,收藏不迷路💖 1、什么是PodSecurityPolicy? PodSecurityPolicy(PSP)是Kubernetes中的一个安全特性,用于在Pod创建前进行安全策略检查,限制Pod的资源使用、运行权限等,提升集群安全性。 2、为什么需要它? 默认情况下,Kubernetes允许用户自由创建Pod,可能带来安全风险。

容器编排平台Kubernetes简介

目录 什么是K8s 为什么需要K8s 什么是容器(Contianer) K8s能做什么? K8s的架构原理  控制平面(Control plane)         kube-apiserver         etcd         kube-scheduler         kube-controller-manager         cloud-controlle

【Kubernetes】K8s 的安全框架和用户认证

K8s 的安全框架和用户认证 1.Kubernetes 的安全框架1.1 认证:Authentication1.2 鉴权:Authorization1.3 准入控制:Admission Control 2.Kubernetes 的用户认证2.1 Kubernetes 的用户认证方式2.2 配置 Kubernetes 集群使用密码认证 Kubernetes 作为一个分布式的虚拟

禅道Docker安装包发布

禅道Docker安装包发布 大家好, 禅道Docker安装包发布。 一、下载地址 禅道开源版:   /dl/zentao/docker/docker_zentao.zip  备用下载地址:https://download.csdn.net/download/u013490585/16271485 数据库用户名: root,默认密码: 123456。运行时,可以设置 MYSQL_ROOT_P

828华为云征文|华为云Flexus X实例docker部署rancher并构建k8s集群

828华为云征文|华为云Flexus X实例docker部署rancher并构建k8s集群 华为云最近正在举办828 B2B企业节,Flexus X实例的促销力度非常大,特别适合那些对算力性能有高要求的小伙伴。如果你有自建MySQL、Redis、Nginx等服务的需求,一定不要错过这个机会。赶紧去看看吧! 什么是华为云Flexus X实例 华为云Flexus X实例云服务是新一代开箱即用、体

kubernetes集群部署Zabbix监控平台

一、zabbix介绍 1.zabbix简介 Zabbix是一个基于Web界面的分布式系统监控的企业级开源软件。可以监视各种系统与设备的参数,保障服务器及设备的安全运营。 2.zabbix特点 (1)安装与配置简单。 (2)可视化web管理界面。 (3)免费开源。 (4)支持中文。 (5)自动发现。 (6)分布式监控。 (7)实时绘图。 3.zabbix的主要功能

【Kubernetes】常见面试题汇总(三)

目录 9.简述 Kubernetes 的缺点或当前的不足之处? 10.简述 Kubernetes 相关基础概念? 9.简述 Kubernetes 的缺点或当前的不足之处? Kubernetes 当前存在的缺点(不足)如下: ① 安装过程和配置相对困难复杂; ② 管理服务相对繁琐; ③ 运行和编译需要很多时间; ④ 它比其他替代品更昂贵; ⑤ 对于简单的应用程序来说,可能不