00 Preface Welcoming Challenges and Embracing the Cloud Native Era

00 Preface Welcoming Challenges and Embracing the Cloud-Native Era #

Hello, I’m Luo Jianfeng, but I prefer you to call me “Chrono.”

Let me introduce myself briefly. As a “tech veteran” with nearly twenty years of work experience, I have been striving in the forefront of development. From Windows to Linux, from hardware to software, from standalone to cluster, and to the cloud, I have developed various forms of applications. I have also worked in companies of different sizes. Currently, I am working at Kong, an API management and microservices platform company. At Kong, I develop products such as Kong Gateway and Kong Ingress Controller based on Nginx/OpenResty.

In fact, I can be considered an old friend of Geektime. In 2019, I created the course “Perspective on the HTTP Protocol,” and in 2020, I created the course “C++ Practical Notes.” However, due to the workload in my job, I “disappeared” for nearly two years.

But during this time, I haven’t been completely oblivious to the happenings outside. I have been keeping an eye on the new technologies and trends in the industry. Today, I am back in this great lecture hall of Geektime to talk to you about the thriving Kubernetes.

The Present of Kubernetes #

You must have heard of Kubernetes, or maybe you are more familiar with its abbreviation that many people often mention – “K8s”.

Since the birth of Docker in 2013, containers have become the hottest topic in the IT industry. Kubernetes, with the help of the container trend and the strong endorsement from Google and CNCF, has defeated Docker Swarm and Apache Mesos, becoming the king of “container orchestration”.

In simpler terms, Kubernetes now has no practical competitors. It has become the de facto cloud-native operating system, just like Linux, and serves as the foundation for building modern applications.

After all, what are modern applications? They are microservices, service mesh, all of which revolve around containers for development, deployment, and running. And when it comes to using containers, the only option now is Kubernetes.

Regardless of whether you are in development, testing, or operations, whether you are on the front end, back end, or middle tier, whether you use C++, Java, or Python, whether you work with databases, blockchain, or artificial intelligence, whether you are involved in websites, e-commerce, or audio-visual, in this “cloud-native” era, Kubernetes is an unavoidable product in our work, a hurdle we will inevitably face.

You may have doubts: my current job has nothing to do with the “cloud”, and Kubernetes has been popular for so long, is it too late to start learning now? Is it worth it?

To answer this, I’ll quote an old saying: “A skill is never too much burden”, and another saying: “Opportunity always favors the prepared”.

“Cloud-native” has become the general consensus in the IT industry now and is the trend of the future. Perhaps this “wave” has not reached you yet, but once it truly arrives, only if you have made the knowledge preparations in advance, can you meet the challenge and become a “player” riding the wave. Otherwise, you may be left “stranded on the beach”.

Let me share my own experience with you.

As early as the release of Docker and Kubernetes, I had some interest in them. However, the languages I mainly worked with were C/C++, while Docker and Kubernetes used Go, and at that time, Go’s performance was relatively poor (such as the famous “Stop the World” caused by garbage collection). Therefore, I only had a basic understanding and did not specifically study them.

After a few years, by chance, we needed to deploy a self-developed application in a client’s environment, but there were significant differences in the dependencies, making it difficult to accomplish. It was at this time that I remembered Docker. After more than a week of struggling and studying numerous materials, I finally managed to launch the system successfully.

Although the task was completed, it made me realize that my previous underestimation of Docker was extremely wrong. Therefore, I made the determined decision to start learning and organizing container knowledge systematically from scratch, and naturally jumped on the “big ship” that is Kubernetes.

Later on, when I wanted to change jobs, during the interview, the boss gave a “special” question about container and environment security in Kubernetes. Although I was unfamiliar with this area, relying on my previous accumulation, I managed to create a 20+ page PowerPoint presentation overnight. The next day, I confidently discussed it with several interviewers and eventually got the offer.

You see, if at that time I stubbornly held my own opinions, staying in my “comfort zone” and not actively learning container technology and Kubernetes, when the opportunity came unexpectedly, I would likely have missed the chance for promotion and salary increase due to being at a loss.

So I also hope that you don’t make the same mistake I made initially. We should see the direction of the era clearly and try to stay ahead of it. The earlier you master Kubernetes, the higher your chances of success in the future.

What are the difficulties in learning Kubernetes? #

So how should we learn Kubernetes?

In fact, the difficulty of learning Kubernetes today has significantly decreased compared to previous years. There is a wealth of online resources available, including blogs, articles, videos, and more. Additionally, Kubernetes has provided detailed tutorials and reference manuals on its official website. As long as you are willing to dedicate time, you can fully “self-learn”.

However, “the ideal is ample, but the reality is bone-wrenching”. In theory, learning Kubernetes should be sufficient by simply studying the available materials, but in reality, learning it can still be quite challenging as we often encounter unexpected problems.

This is because Kubernetes is a distributed, clustered, and cloud-based system with many new concepts and ways of thinking that differ greatly from our previous experiences and knowledge.

I believe that the characteristics of the Kubernetes technology stack can be summarized in four words: “new, extensive, diverse, and profound”.

  • “New” refers to the fact that Kubernetes utilizes cutting-edge and unfamiliar technologies. Moreover, its versions evolve rapidly and often change.
  • “Extensive” implies that Kubernetes spans across many application areas, with a wide coverage. It can be difficult to find a suitable starting point or breakthrough.
  • “Diverse” suggests that Kubernetes has many different implementations, making it confusing to navigate with everyone having their own contributions, making it overwhelming for newcomers.
  • “Profound” means that to address specific problems and directions in Kubernetes, one needs to possess deep technical background and knowledge. Gaining a thorough understanding can be quite challenging.

These four characteristics make Kubernetes’ learning “threshold” quite high, with a steep learning curve and significant costs. It is possible to spend a great deal of time and effort, only to find that progress is limited. Speaking from personal experience, I have deeply felt this challenge.

For example, during my early stages of learning Kubernetes, I encountered the following questions. I wonder if you have felt the same:

  • Docker, Containerd, K8s, K3s, MicroK8s, Minikube… with so many projects, how do I choose?
  • The concept of containers is too abstract. How can I understand it quickly and accurately?
  • The naming of images is strange, with terms like “bionic” and “buster”. What do they mean?
  • I don’t know how to set up a Kubernetes environment. I only have theoretical knowledge and cannot apply it practically.
  • YAML files are long and messy. Where can I find explanations and is there a simple rule to follow when writing them?
  • Pods, Deployments, StatefulSets… with so many objects, is there any inherent coherence and connection between them?

Sadly, it is difficult to find answers to these questions in existing Kubernetes resources.

I personally feel that they often “start from a high point” without considering beginners with “zero foundation”. They often make assumptions, such as familiarity with the Linux system, knowledge of programming languages, understanding of networking technologies, and more. Sometimes the information becomes obsolete due to version upgrades or critical details are unintentionally omitted.

This often causes beginners to get stuck on seemingly irrelevant but practical difficulties. These accumulated difficulties gradually erode one’s confidence and courage to learn Kubernetes.

Therefore, based on my learning experience, I will integrate personal insights, lessons learned, and practical techniques to create a beginner’s roadmap and systematic approach to learning this new technology called Kubernetes. This will provide you with shortcuts, so you no longer feel lost and confused, and can efficiently enter the grand hall of Kubernetes.

How to Learn Kubernetes in This Column #

Now that we’ve discussed this, you must be wondering what makes this column unique and different from other courses. Based on the four characteristics of the Kubernetes technology stack we mentioned earlier, namely “new technology, broad scope, complex implementation, and deep direction”, let me explain my thoughts and considerations in detail.

  1. First, there are not many prerequisites, and you can learn even if you don’t know Go.

In this course, I won’t require you to learn Go programming language or delve into the Kubernetes source code.

Although I come from a development background, I don’t have an in-depth understanding of Go. However, I believe this is actually an advantage. When facing Kubernetes, you and I are on an equal footing. I won’t instinctively explain its operating principles from the source code level, which allows me to empathize with you more.

While understanding the source code may be thorough, its prerequisites are too high, and not everyone possesses such a foundation. It is a bit “putting the cart before the horse” to learn Go language before learning Kubernetes, as Qian Zhongshu, a famous Chinese writer, once said: “If you’ve eaten an egg and find it tasty, why bother getting to know the hen that laid it?” (I think this can also be compared to the Linux operating system, which is written in C language, but hardly anyone requires us to master C language before learning Linux.)

But if you truly want to do Kubernetes development, once you have mastered the basic concepts and usage of Kubernetes, you will still have plenty of time to learn Go language.

  1. Second, this column is positioned as an “introductory” course, meaning I won’t explain complicated principles and workflows, and I will use simple and plain language, minimizing the use of professional terminology and abbreviations.

After all, the Kubernetes system covers a vast domain, and directly diving into internal details is not suitable for beginners, who might easily get sidetracked and delve into minutiae.

I believe the best way to learn Kubernetes is to quickly establish an overall view and understanding of the unfamiliar domain, and then select an area that interests you to dive deeper into. This offers the best value for your learning effort.

Moreover, as mentioned earlier, Kubernetes versions update rapidly, and certain features may become deprecated over time (such as ComponentStatus being deprecated in version 1.19 and PodSecurityPolicy being deprecated in version 1.21). If we focus too much on the finer details, it would be embarrassing if they become obsolete and useless in the future.

  1. The course will be project-oriented, emphasizing a combination of theory and practice. You will be encouraged to be hands-on and actually perform operations. I believe this is the most prominent feature of this course.

Kubernetes usually releases one major version per year, and each major version has numerous minor versions. Each version continuously improves its functionality and features. However, it is not practical to blindly pursue the latest version when it might not align with current practical situations. After all, stability is the most important aspect when it comes to production environments.

Therefore, I chose Kubernetes 1.23.3, which was released at the beginning of this year (2022). It is the final major version to support Docker and serves as a bridge between past and future. It includes many new features, while still maintaining sufficient historical compatibility. This makes it an ideal choice for learning Kubernetes.

In the course, I will start with Docker and gradually build single-node and multi-node Kubernetes clusters using tools like Minikube and Kubeadm. While explaining concepts, I will also provide numerous Docker and Kubectl commands, allowing you to immediately get hands-on practice after completing each lesson and reinforce your learning with practical experience.

  1. Finally, for each lesson, I will prioritize being concise rather than overwhelming with excessive content. I will aim for lean and focused lessons, focusing on a single knowledge point.

This is because Kubernetes covers such a wide array of domains, and its knowledge structure is interconnected, making it easy to get distracted and go off on tangents while studying. This can lead to scattered thinking.

Therefore, I will strive to keep the lessons restrained, focusing on a relatively independent scope for each lesson. There won’t be too many digressions, and I won’t mechanically list API, command parameters, or attribute fields (you can refer to the Kubernetes documentation for those). When explaining complex knowledge points, I will also include images to help you precisely understand and absorb the knowledge.

For example, understanding the relationships between various API objects like Pods has always been a challenge when learning Kubernetes, and it’s difficult to explain purely with words. Therefore, I have created plenty of diagrams to help you visualize their connections. Like this one:

Image

Since each lesson focuses on a single knowledge point, I have also designed a unique learning path for the entire column. It simplifies the knowledge structure of Kubernetes from a mesh-like structure into a linear structure. You can progressively learn the complete Kubernetes knowledge system in a structured manner, starting from the basics and gradually advancing to more complex topics.

What is the linear structure of the column? #

Based on these ideas, I have divided the column into five main sections.

  • Preparatory work

Before the formal study, there will be a lesson in preparation, which is also a convention for me when writing columns. I will tell you about the experimental environment we are studying, and use virtual machine software to build a Linux system to eliminate some of the worries that beginners may have but may not be covered elsewhere.

  • Beginner’s section

I will use the popular Docker to explain the basic technology of Kubernetes: containers, so that you can understand its basic principles, familiarize yourself with common Docker commands, and be able to easily pull, build images, run containers, and use containers to set up development and testing environments on your local machine.

  • Intermediate section

After acquiring knowledge of containers, we can move on to learning Kubernetes, using the single-node environment minikube. You will understand why containers have evolved to container orchestration, what problems Kubernetes solves, what its basic architecture looks like, and then learn about the YAML language, core object Pod, as well as offline business objects such as Job/CronJob, configuration information objects ConfigMap/Secret.

  • Advanced section

Building on the foundation of the “Intermediate section”, we will proceed further and use kubeadm to set up a multi-node cluster to simulate a real production environment. We will also introduce 4 important concepts in Kubernetes: Deployment, DaemonSet, Service, Ingress. Once you have learned these objects, you will understand the advantages and characteristics of Kubernetes, and why it has become the operating system of the cloud-native era.

  • Advanced section

After studying the previous modules, you will already have a comprehensive understanding of Kubernetes, so I will explain some deeper knowledge points and advanced application techniques, including persistent storage, stateful objects, rolling updates and automatic scaling of applications, container and node management, etc.

Of course, this pure linear learning approach is not without its drawbacks, so I will use other forms to supplement and enrich your learning process, such as knowledge tips and interactive Q&A after each lecture.

In the middle and later stages of the column, I will also prepare some “bonus content” for you, talking about some “side stories” related to Kubernetes, such as docker-compose, CNCF, API Gateway, etc., to expand some knowledge that may be peripheral but still very practical.

As mentioned earlier, it is important to practice hands-on. To reinforce the practical effect, after learning the knowledge points in each module, I will arrange a practical exercise class and a video class:

  • In the practical exercise class, we will use the knowledge learned in the module to build a WordPress website, and you can follow the course to see how it evolves from a single application to a high-availability system in a cluster.
  • In the video class, I will demonstrate most of the important knowledge points in this module through actual operation. I believe that through the combination of “text + images + audio + video”, your learning will be very fulfilling and satisfying.

Your journey with Kubernetes is going to start soon. Here is a knowledge map of the course for you, hoping that you can accompany it in the next three months, and cultivate the flower of learning with effort and perseverance, and harvest abundant knowledge and joy!-

Click here ๐Ÿ‘‰Learning and Communication Group to join the group and grow quickly with Teacher Luo and the technical experts.

Tools for drawing in the column: Keynote for knowledge explanation, Xmind for mind maps.