A few steps to protect your K8S cluster

Kirill
ITNEXT
Published in
4 min readFeb 17, 2022

--

Policy, Protect Access Controllers

The most important tasks in securing a Kubernetes environment are the quality of access control as well as the security of user authentication or authorization. Webhook access controllers are used to solve this problem. But as soon as any new component is added to the cluster, it can lead to unexpected difficulties. For example, an application might not be deployed correctly, or there might be management issues.

It becomes obvious that there is a need to manage risks effectively on the part of both users and developers. To simplify this process, a threat model for access controllers was created.

The main purpose of this development is to consider all the potential risks that arise when access controllers are used incorrectly.

As a result of the misuse of controllers, attackers are theoretically able to bypass security policies, which opens up a direct and unauthorized path for them to the closed clusters, which should initially be well protected and secure.

How to Protect Access Controllers and Closed Clusters from Unauthorized Access?

The threat model mentioned above became the basis for the further development of new tools and methods for protecting controllers. The use of such security methods helps cluster operators to avoid all potential risks associated with the process of using the product.

Having a ready-made risk model provides operators with quite a few safety benefits. They are multidirectional, which means you can count on their high efficiency.

  1. The security of all cluster members is achieved by verifying the configuration of all members in the cluster. In this context, properly configuring TLS for all webhook traffic is important — communication between APIs and webhooks must be encrypted in order.
  2. You also need to make sure that only authenticated access is allowed. The fact is that without such an item, an attacker will be able to send an unlimited number of access requests to the controller. As a result, the service will be overloaded, which will ultimately lead to system failure. The use of authenticated access is a guarantee that the risk of development of such a situation is reduced several times.
  3. It is equally influential to reach a compromise between cluster members that are available at the time of failure and those components that are most significant and, therefore, should remain closed. The essence of the approach is to keep some critical components closed and protect them from unauthorized access but, at the same time, retain the possibility to deploy certain clusters. In practice, this model of security compliance, which takes into account trade-offs, is the most workable.

Another component that serves to secure the system is the regular checking of the webhook configuration. Depending on the situation, this can be done manually or automatically. The most important thing is to make sure that the settings in the webhook configuration are correct and, thereby, avoid vulnerabilities caused by errors in such a configuration.

Verify that Kubernetes Security Features Are Configured Correctly

A very popular practice is to install an admission controller webhook as a cluster workload. If your digital product experiences the same situation, it makes sense to make sure that all Kubernetes security settings are correct, which can even theoretically affect the operation of the application in this environment. The next steps will be as follows:

  1. Restriction of Role-based access control (RBAC) rights.
  2. Limiting requirements for privileged (critical) workloads.
  3. Using network policies to minimize the risk of sending sensitive information outside the cluster.
  4. Every cluster should have a separate webhook — this will complicate access to every individual component.

Controlling access to an external system, coupled with increased access complexity requirements, is the most essential topic on this list. If you really care about the security and reliability of the application, you will have to pay special attention to these points.

Admission Controller Rule Base

The security of the Kubernetes environment is directly dependent on the rule base that is used in relation to the functioning of every component and cluster. And since rules are a key component of security, they must be designed to accurately achieve goals, bypassing potential false positives and false negatives.

You cannot say from the outset that the rules are created exactly according to this requirement. Any rules that are used in your product should be regularly reviewed and tested. This is the only way to eliminate possible errors and guarantee the accuracy of execution and the effectiveness of their application.

Moreover, with each release of the Kubernetes API, the rules need to be reviewed and evaluated again. This happens because they must take into account all external realities and changes to keep them up to date and ensure that they still cope with the functions assigned to them.

Securing applications deployed in the cloud requires new approaches to security. This is not always convenient, and developers are forced to dive into the study of new methods, approaches, and tools. However, it is the support of product security at the current level that guarantees successful promotion on the market and positive feedback from users. Therefore, carefully study the information above again so as not to miss anything and guarantee your customers a worthy and safe product.

--

--

[DevOps] I’m a member of “I want to know everything” and “I’m happy to share what I’ve already learned” groups. https://kazakov.xyz