Skip to content

About This repository contains a comprehensive Bash script designed to automate the deployment and hardening of Kubernetes clusters. By leveraging the CIS Kubernetes Benchmark 2024, this project aims to enhance cluster security and compliance while streamlining the setup process.

License

Notifications You must be signed in to change notification settings

Om1705/Automation-and-Hardening-of-Kubernetes-Cluster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Automation-and-Hardening-of-Kubernetes-Cluster

This repository contains a comprehensive Bash script designed to automate the deployment and hardening of Kubernetes clusters. By leveraging the CIS Kubernetes Benchmark 2024, this project aims to enhance cluster security and compliance while streamlining the setup process.

Automation and Hardening of Kubernetes Cluster

Table of Contents

Project Overview

This project focuses on the automation and security hardening of a Kubernetes cluster. The objective is to automate the deployment, configuration, and hardening processes to ensure that the Kubernetes environment is secure, resilient, and ready for production use.

Features

  • Automated Kubernetes Cluster Setup: Scripts to automate the setup of a Kubernetes cluster.
  • Security Hardening: Implementation of best practices for securing the Kubernetes environment, including network policies, RBAC, pod security policies, and more.
  • Modular and Scalable: Easily adaptable to different environments and scales for clusters of various sizes.
  • Compliance with Security Standards: Aligns with industry standards and guidelines like CIS Kubernetes Benchmark.

Prerequisites

Before you begin, ensure you have met the following requirements:

  • A system running Linux (CentOS, Ubuntu, Debian, or Kali).
  • Root or sudo access to your system.
  • Basic knowledge of Kubernetes, Docker, and Linux commands.
  • The following software installed:
    • Docker
    • Kubernetes (kubeadm, kubectl, kubelet)
    • git
    • curl
    • sed, grep, and other common Unix utilities

Installation

Follow these steps to set up the project:

  1. Clone the Repository:

    git clone https://github.com/yourusername/kubernetes-cluster-hardening.git
    cd kubernetes-cluster-hardening
  2. Run the Setup Script: Execute the primary setup script to deploy the Kubernetes cluster:

    bash setup.sh
  3. Configure Environment: Edit any configuration files as necessary to match your environment. Key files to consider:

    • config/kubernetes.conf
    • config/firewall.conf
    • config/containerd-config.toml
  4. Start the Hardening Process: Run the hardening script after the cluster is set up:

    bash hardening.sh

Usage

Once the setup and hardening scripts have been executed, you can manage your Kubernetes cluster as usual with kubectl commands. The cluster should now be secured according to the best practices outlined in the hardening script.

Example Commands:

  • Check Cluster Nodes:

    kubectl get nodes
  • Deploy an Application:

    kubectl apply -f deployment.yaml

Cluster Hardening

The hardening script implements several security measures, including but not limited to:

  • Network Policies: Restricting network access between pods.
  • Pod Security Policies: Ensuring pods run with the minimum necessary privileges.
  • Role-Based Access Control (RBAC): Enforcing strict access controls on Kubernetes resources.
  • Audit Logs: Setting up audit logging to track API server requests.
  • Image Security: Using signed and verified container images.

For more details, refer to the hardening guide.

Contributing

Contributions are welcome! Please follow these steps to contribute:

  1. Fork the repository.
  2. Create a new branch (git checkout -b feature-branch).
  3. Make your changes and commit them (git commit -m 'Add new feature').
  4. Push to the branch (git push origin feature-branch).
  5. Open a pull request.

Please ensure your code adheres to the existing code style and includes appropriate tests.

License

This project is licensed under the GNU GENERAL PUBLIC LICENSE. See the LICENSE file for details.

Acknowledgments

About

About This repository contains a comprehensive Bash script designed to automate the deployment and hardening of Kubernetes clusters. By leveraging the CIS Kubernetes Benchmark 2024, this project aims to enhance cluster security and compliance while streamlining the setup process.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages