5 things to manage Kubernetes, do you know them all?

Kubernetes administration can be intimidating for developers without specialized systems to understand orchestration techniques. Learning Kubernetes takes a lot of time, and for developers under pressure to deliver new applications, time is often not enough.
So, this article provides what you need to know about Kubernetes management.

1. 【5 things to manage Kubernetes】Kubernetes naming conventions


As a developer, knowing that objects created in Kubernetes must follow specific naming conventions will help you implement and manage Kubernetes faster. Knowing how these work and why something is named a certain way will also help in making connections to the application or the underlying infrastructure, as well as in troubleshooting.
Each Kubernetes object has a name that is unique to a resource and a Unique Identification Object (UID) that is unique across the cluster. Kubernetes.io says, "There can only be one Pod named myapp-1234 in the same Namespace, but you can have a Pod named myapp-1234 and a Deployment named myapp-1234."
Additionally, Pods with higher-level controllers (eg ReplicaSets /Deployments) will inherit their naming prefix. For example, if your Deployment name is webapp, the corresponding ReplicaSet might be webapp-12345678, and the corresponding pod under it might be webapp-12345678-abcde. This way, each pod in this namespace has a unique name, which also tells which pods share the same controller.

2. 【5 things to manage Kubernetes】How to make your application work


Kubernetes users should have a basic understanding of Services and Deployments.
Services are just a general way of routing network traffic within a cluster, and sometimes from outside as well.
For example, a Service named webapp routes traffic to a pod labeled app:web. Any pod in the same Namespace can invoke a webapp pod by making a request to the URL http://webapp. Traditionally, when setting up a network, there are many steps to ensure that traffic is routed to the right place, but using Services in Kubernetes allows you to provide instructions at a higher level, and the resulting actions are automated.
Deployment is the simplest high-level controller. In a stateless application, it is enough for the developer to know that the Deployment can do rolling updates, such as how many replicas you need and which version you use. This ensures that your application connects to the correct endpoint; everything in between happens automatically. For more complex applications, some other advanced controllers may need to be explored, such as StatefulSets and Cron jobs.
It is also helpful to understand the main principles of containers: how to get a consistent state? If an update or operation causes the application to behave abnormally, simply restart the container to reset it. The containers may also not be on the same node.

3. 【5 things to manage Kubernetes】How to get application information?


This is what most developers care about no matter what infrastructure you're running on. Where is the problem, how bad is the problem, is it my problem? The last question may seem a bit cynical, but knowing which team and developer is best suited to solve a problem is critical to operational efficiency. The main question you need to answer is: How can I tell if my application is running and what is the resource consumption?
One thing to note is that using the command kubectl get events will give you all application events. Unfortunately, Kubernetes doesn't order them in any particular way, but as your knowledge builds up and your understanding improves, you can filter and sift through these queries.

4. How to detect problems in time
One of the benefits of Kubernetes is its ability to automatically roll back to a consistent state, but this can mask the impact of potential problems. Therefore, developers need to have access to Kubernetes logs and telemetry data.
Among them, metrics such as CPU or memory usage are important for Kubernetes-based applications because they can reveal application problems that Kubernetes may mask.

5. When to troubleshoot
The core of Kubernetes is to have applications running in production, so there is generally no direct system output that can explain why an application crashes.
Most of the time, Kubernetes just restarts the container and the problem is solved, thanks to the self-healing and resilient nature of Kubernetes and containers, but this can mask or hide bad application behavior and also cause the problem to be delayed longer ignored.
Sometimes, we need to investigate a problem more deeply, such as whether it affects the customer experience, or negatively affects other teams, the type of service provided, and how well the performance is.

Summarize
While it's important for developers to understand how their applications run on Kubernetes, in most cases they don't need a deep understanding of how Kubernetes works. As a developer, Kubernetes may seem chaotic to some extent, but you can control the clutter by providing specific directions. For example, if you don't specify where the pod runs, it will run anywhere by default. Alternatively, you can use taints/tolerations to tell Kubernetes not to run applications on specific nodes. Whether you configure (or not) it, you can use basic automatic checks to show if an application is healthy.
When developers start using Kubernetes, don't make it too complicated. Think of it as a way to manage your application, a system that automatically takes action to repair itself and return to a healthy state with little intervention. As your knowledge and experience grow, your Kubernetes implementation can be extended as needed to make it as robust as possible.

Copyright statement: The content of this article is contributed by Alibaba Cloud's real-name registered users. The copyright belongs to the original author. The Alibaba Cloud developer community does not own the copyright and does not assume the corresponding legal responsibility. For specific rules, please refer to the " Alibaba Cloud Developer Community User Service Agreement " and " Alibaba Cloud Developer Community Intellectual Property Protection Guidelines ". If you find any content suspected of plagiarism in this community, fill out the infringement complaint form to report it. Once verified, this community will delete the allegedly infringing content immediately.

Related Articles

Explore More Special Offers

  1. Short Message Service(SMS) & Mail Service

    50,000 email package starts as low as USD 1.99, 120 short messages start at only USD 1.00