Access Management for Kubernetes (Part 1)
Want to learn more about access management for Kubernetes? Check out this post about the benefits of implementing a fine-grained access management solution in Kubernetes.
Join the DZone community and get the full member experience.
Join For FreeWhat Is Fine-Grained Access Management?
The need for implementing an access management solution mandates us to identify the resources that we want to protect. This is a resource that we may want to give different levels of protection, meaning the resource should be accessed only by a few privileged users. We would want to have control over who is accessing it and what do they want to DO with it. Typical operations on resources, for example, are ‘create, ‘read,' ‘update,’ and ‘delete’ CRUD operations.
Why Does Kubernetes Need Fine-Grained Access Management?
Before getting into access management in Kubernetes, we need to understand the resources that Kubernetes holds. Resources in Kubernetes are comprised of system nodes, pods, containers, volumes, cluster-info, metadata, and much more. Now that we know what needs to be protected in Kubernetes, it's time to ask ourselves a few questions about the security of our resources.
- Should we treat each user equally?
- Should there be a mechanism to identify users on the basis of the different level of privilege that each one has?
- How can we allow a user to create pods if it doesn't have required privileges?
- If a user has access to one resource inside the cluster does that mean it can access anything inside our cluster?
Do we have a problem here? Yes!
Our Solution
We have worked on an access management solution for Kubernetes using the CA Single Sign-On (SSO) by configuring a web-hook. The basic understanding of the solution is that, by default, each request that comes towards the Kubernetes cluster will be processed by an API server (Note: the API server is a pod that resides on the master node of the Kubernetes cluster). So, the API server is the single entry point for every request that comes into the cluster. We deployed a webhook on the master to intercept every incoming request and then redirect it to our service SSO for further authentication and authorization. Only when SSO sends an access granted response back to our webhook, then the intercepted request is allowed to be executed inside the cluster. Otherwise, the request is blocked with the appropriate response sent back to the user. A diagram is attached to get a better understanding of this solution.
Why Do We Need It?
Now, we have an idea of why is it important to have an access management solution for our cluster environment. But first, we should know about available solutions, along with the pros and cons.
Let us go over the benefits of our proposed solution:
- No more use of Command Lines tool — there is one single interface to manage everything inside our cluster.
- Ease of management: There is no need to get inside the cluster configuration for changing any simple details like adding a new user.
- Continue to focus on business app development without the need to worry about security.
How Is it Different From What Kubernetes Has to Offer?
Kubernetes comes in with a default RBAC (Role Based Access Control) mode of authorization mechanism.
There are various problems related to this mechanism, such as
- High level of access management: This default mechanism of Kubernetes is effective but not up to fine-grain level. It provides a sufficient amount of security measures, but if we are looking for a better and more secure solution, then this may not be the right choice.
- Size of the cluster and manual workload: This mechanism makes you perform everything from the command line, and you have to rely heavily on your cluster administrator for performing every task. This problem becomes much larger when the size of the cluster grows and so does the number of users in your cluster.
- Diversification of users and resources: The most important part about fine-grain access management is that it treats every user and resource differently which makes it question everything and offers much more control over cluster resources. This can't be achieved with existing command line tool, and even if it's possible then it will be a very tedious task
How Does it Fit Into Your Existing Environment?
Usually every organization is equipped with on-premise single-sign-on solutions, like CA SSO, to protect their organization applications. Since you already have an on-premise SSO solution deployed, you can leverage the same solution to protect the Kubernetes resources as well.
The approach of using your existing SSO solution to protect Kubernetes resources helps you minimize cost of learning new solutions and the cost of staffing since your existing staff can continue to manage new Kubernetes resources.
The new webhook is being written in order to support this kind of integration with existing SSO environments. This webhook runs on the Master of your Kubernetes cluster and redirects the request to your SSO environment. It is assumed that your SSO environment is capable of checking if the received URL is protected or not based on the rules and policies that your SSO environment was configured with.
Conclusion
We have seen the need of fine-grained and effective access management, and also understood how the proposed solution works at a high level. We will be looking into how to integrate with your existing SSO solution taking an example of CA SSO in the next article.
Opinions expressed by DZone contributors are their own.
Comments