kubernetes_Kubernetes之旅1

kubernetes

While scheduling classes for my final semester of college, I was very eager to do something different. Like many of my computer science peers, I had grown tired of the typical class where we have to reinvent the wheel when learning new concepts. However important it my be to understand those concepts and know what goes on behind the scenes, it was time for a change of pace. That’s where the idea of taking an Individual Study course came to mind.

在为我的大学最后一个学期安排课程时,我非常渴望做一些不同的事情。 像我的许多计算机科学同行一样,我已经厌倦了典型的课程,在学习新概念时,我们必须重新发明轮子。 了解这些概念并知道幕后发生的事情对我来说多么重要,但现在是改变步伐的时候了。 那就是想到个人学习课程的想法。

The plan was relatively simple (naturally, this all had to be okayed by my professor). I was going to use four Raspberry Pi’s, one master and three worker nodes to create a Kubernetes Cluster. After that, the goal was to deploy databases, scheduled tasks, API’s, front-end applications and setup a CI/CD tunnel. Once all of this was up and running, I would then compare and contrast this new environment to my current environment running on multiple servers and virtual machines. Pretty straight forward right!?

该计划相对简单(自然,这一切必须由我的教授同意)。 我将使用四个Raspberry Pi,一个主节点和三个工作节点来创建Kubernetes集群。 之后,目标是部署数据库,计划任务,API,前端应用程序并设置CI / CD隧道。 一旦所有这些都启动并运行,我便将这个新环境与当前在多台服务器和虚拟机上运行的环境进行比较和对比。 很简单吧!?

Image for post

Creating the cluster was actually easier than expected. There was an obvious learning curve, but what was supposed to take a couple weeks only took a couple days. Figuring that I was off to a good start, I jumped right into setting up a CI/CD (Continuous Integration/Continuous Delivery) pipeline on the cluster. This is where the real fun started (sarcasm). For the longest time, I have been wanting to learn how to use Jenkins and I thought this project would be a good place to start. I really wanted it to run in a container on the cluster. I searched high and low looking for a Docker container that would support the ARM architecture of Pi’s. Unfortunately, no such luck. In the end, I settled on setting it up on one of my local machines and used it to create Docker images from a Github repo and deploy them to the cluster.

创建集群实际上比预期的要容易。 学习曲线很明显,但是原本要花几个星期的时间才花了几天。 考虑到我起步良好,我立即进入了在集群上设置CI / CD(连续集成/连续交付)管道的工作。 这是真正的乐趣开始的地方(讽刺)。 一直以来,我一直想学习如何使用Jenkins,我认为这个项目将是一个不错的起点。 我真的希望它在集群上的容器中运行。 我在上下搜寻了一个支持Pi的ARM体系结构的Docker容器。 不幸的是,没有这样的运气。 最后,我决定在我的一台本地计算机上进行设置,并使用它从Github存储库创建Docker映像并将其部署到集群。

The second sucker punch came with MySQL. I got the persistent volume and persistent volume claim all set up only to run into the same road block of no Docker image for ARM. I spent a few days trying some potential workarounds that were found on Google, but no such luck getting these to work. Since I couldn’t spend anymore time trying to get a MySQL image to run, Postgres seemed like a good alternative. Luckily, I was able to get the Postgres image up and running and also successfully created a test database as well.

MySQL带来了第二个麻烦。 我得到了持久卷和持久卷声明,所有这些设置都是为了在没有适用于ARM的Docker映像的同一路障中遇到的。 我花了几天时间尝试在Google上找到的一些可能的解决方法,但运气不佳。 由于我不再花时间尝试运行MySQL映像,因此Postgres似乎是一个不错的选择。 幸运的是,我能够启动并运行Postgres映像,并且还成功创建了一个测试数据库。

At this point, it was time to add a test API and front-end application. For the API, I quickly created it using Python (Flask micro-framework specifically) and connected it to the Postgres database. After that, I created an Angular application and built it for production use (Nothing fancy, just a “hello world” app). It took me quite a long time to figure this out, but when creating Docker images for custom applications they need to be created on a machine that is the same architecture as the one you are deploying to. Once I realized this, they worked pretty well when testing in Postman and a web browser.

此时,是时候添加测试API和前端应用程序了。 对于API,我Swift使用Python(特别是Flask微框架)创建了该API,并将其连接到Postgres数据库。 之后,我创建了一个Angular应用程序并将其构建用于生产用途(没什么,只是一个“ hello world”应用程序)。 我花了很长时间才弄清楚这一点,但是在为自定义应用程序创建Docker映像时,需要在与要部署到的相同体系结构的机器上创建它们。 一旦意识到这一点,它们在Postman和Web浏览器中进行测试时就可以很好地工作。

At last I was able to do the comparison of the cluster to the servers running services, apps, databases, etc. on virtual machines. In my case, I was comparing a server (Dell Poweredge R710) to Raspberry Pi’s, so I wasn’t looking at CPU and RAM performance. Instead, deployment time performance, deployment ease of use and disk space storage were more of a concern. For deployments, there was an obvious learning curve, but configuring the yaml files and then pushing them to the cluster was very simple and gave me some ideas on potential automation using Jenkins. In terms of disk space storage, there were some obvious savings there. Unlike my current setup where applications are organized onto different virtual machines, the cluster spreads out the different applications across the worker nodes utilizing the storage of those nodes in a more effective way.

最后,我能够将群集与在虚拟机上运行服务,应用程序,数据库等的服务器进行比较。 就我而言,我正在将服务器(Dell Poweredge R710)与Raspberry Pi进行比较,因此我没有考虑CPU和RAM的性能。 相反,部署时间性能,部署易用性和磁盘空间存储更加值得关注。 对于部署而言,学习曲线很明显,但是配置yaml文件然后将它们推送到集群非常简单,这给了我一些使用Jenkins进行自动化的想法。 在磁盘空间存储方面,有一些明显的节省。 与我当前的应用程序将应用程序组织到不同的虚拟机上不同,群集通过更有效的方式利用这些节点的存储在工作节点上分布了不同的应用程序。

To sum things up, this was an amazing learning experience. I definitely accomplished the goal of getting to do something different in my final semester of college. In Part 2, we’ll move from the Raspberry Pi’s onto an actual server that will contain virtual machines as our cluster. I hope you enjoyed this part of the journey and will continue with me onto the next. Cheers!

总结起来,这是一次了不起的学习经历。 我在大学的最后一个学期肯定完成了要做一些与众不同的目标。 在第2部分中,我们将从Raspberry Pi迁移到实际的服务器,该服务器将包含虚拟机作为集群。 我希望您喜欢这段旅程,并将继续与我一起前进。 干杯!

翻译自: https://medium.com/@wolfetechhacks/a-journey-with-kubernetes-part-1-403ce51c5e95

kubernetes

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值