fbpx

5 Best Security Practices for Kubernetes

Microservices team wattlecorp todayAugust 8, 2020 40 3 5

Background
share close

5 BEST PRACTICES FOR KUBERNETES SECURITY

A portable open-source tool for managing containerised applications, Kubernetes was the talk of the town when it was first out. But anyone who followed the software closely would be aware of the security vulnerabilities that became the reason why this technology dropped its reach. Security issues would pop up from anywhere from runtime engines to container images and weak networks.

The importance can’t be overstated especially at a time when companies are increasing their dependence on containers. Examples of everyday digital applications used by us that include containers are Google web search, a huge chunk of the Microsoft UI and Amazon Web Services (used by a lot of websites) among others. Now that you’ve understood its importance in daily life, it is even more required to keep it safe. Here are the 5 best security practices that can be adopted while using Kubernetes.

1. Enabling Role-Based Access Control (RBAC)

KUBERNETES Security

RBAC is a Kubernetes feature that allows you to control whoever has access to the Kubernetes API and the permissions given to them. This is enabled by default to ensure no user has more permissions than required for their responsibilities. The RBAC API provides four top-level roles:

  1. Role can be used to grant access to resources within a single namespace.
  2. Cluster-Role adds cluster-scoped resources, non-resource endpoints and resources from other namespaces to the Role type.
  3. RoleBinding grants permissions defined in a role to a user or set of users.
  4. ClusterRoleBinding is the same as RoleBinding but across a cluster.

RBAC plays a huge role when companies have developers branched into strict departments with no common area.

2. Update to the Latest Version

Just like any application and software even Kubernetes needs to be kept updated to the latest version to avoid being exposed to any security vulnerabilities that have been fixed since then. 

There are possibilities that the containers in your application contain known or unknown vulnerabilities. To keep your application better equipped, update the source image and redeploy them into the respective containers. This is more recommended than directly updating the containers which might make the images broken.

3. Using Namespaces

5 BEST SECURITY PRACTICES FOR KUBERNETES

Kubernetes uses the concept of namespaces to establish security boundaries. Creating separate namespaces establishes the first level of isolation between different components. There is a limitation when it comes to the usage of multiple namespaces.

Kubernetes doesn’t have a mechanism that provides security across namespaces. Hence it is recommended to use namespaces only when a need to separate two components is present. For things like limiting users to a specific component, the creation of a namespace is unnecessary and poses a security risk which can be avoided. Using RBAC is better suited for such control over users.

4. Enabling Audit Logging

One of the most important things to do while working on Kubernetes is to enable audit logs and frequently monitor them. Unwanted or anonymous API calls are to be noted, especially in times when authorisation failures have been encountered. This implies something unwanted could be happening. While not everything might be external, it could also be an internal user trying to access something in a different namespace.

KUBERNETES and Container Security

All log entries have the status message “Forbidden”. Kubernetes offers cluster-based logging, allowing all container activity to be logged into a central log hub. Once the central log hub is created, all the standard outputs and error outputs of each container can be ingested using an efficient agent running each node into Google Stackdriving Logging.

5. Securing Pods and Containers

Pods are objects that house one or more containers. While configuring your pods and containers, ensure that the security context has been configured accordingly for each of them.

Pod Security Policies set defaults on how to run workloads in each cluster. Instructions to define and enable a Pod Security Policy varies depending on the cloud provider and/or deployment model.

A Pod Security Policy allows administrators to control the  following:

  • Running containers with privileges
  • Usage of host namespaces
  • Volume type usage
  • Host file system usage 
  • Usage of the read-only root file system
  • User and group container IDs and much more.

Interested to know more about different ways to secure Kubernetes and thereby your application safty? We have more to offer through our ethical hacking coaching. To learn more in the field of cybersecurity, join our ethical hacking training program. We train people in the best way possible, experiencing it in the real world while working as a part of our ethical hacking internship. For more cybersecurity lessons in similar topics, join our ethical hacking internship program.

Contributors : Aswin Prasad, Labeeb Ajmal

Written by: team wattlecorp

Tagged as: .

Rate it

Previous post

todayAugust 6, 2020

  • 174
  • 1
close

ethical hacking team wattlecorp

Top 7 Ethical Hacking Tools

Top 7 Ethical Hacking Tools Ethical hacking refers to the authorised bypassing of system security to identify potential vulnerabilities, data breaches and threats in a network. This is a planned, ...


Similar posts

Post comments (0)

Leave a reply

Your email address will not be published. Required fields are marked *