🛡️
CTHFM: Kubernetes
  • Welcome
  • Kubernetes Fundamentals
    • Kubernetes Components
      • Kubernetes Master Node
      • Worker Nodes
      • Pods
      • Service
      • ConfigMaps and Secrets
      • Namespaces
      • Deployments
      • ReplicaSets
      • Jobs and CronJobs
      • Horizontal Pod Autoscaler (HPA)
      • Kubernetes Ports and Protocols
    • Kubectl
      • Installation and Setup
      • Basic Kubectl
      • Working With Pods
      • Deployments and ReplicaSets
      • Services and Networking
      • ConfigMaps and Secrets
      • YAML Manifest Management
      • Debugging and Troubleshooting
      • Kubectl Scripting: Security
      • Customizing Kubectl
      • Security Best Practices
      • Common Issues
      • Reading YAML Files
    • MiniKube
      • Intro
      • Prerequisites
      • Installation MiniKube
      • Starting MiniKube
      • Deploy a Sample Application
      • Managing Kubernetes Resources
      • Configuring MiniKube
      • Persistent Storage in Minikube
      • Using Minikube for Local Development
      • Common Pitfalls
      • Best Practices
  • Kubernetes Logging
    • Kubernetes Logging Overview
    • Audit Logs
    • Node Logs
    • Pod Logs
    • Application Logs
    • Importance of Logging
    • Types of Logs
    • Collecting and Aggregating Logs
    • Monitoring and Alerting
    • Log Parsing and Enrichment
    • Security Considerations in Logging
    • Best Practices
    • Kubernetes Logging Architecture
  • Threat Hunting
    • Threat Hunting Introduction
    • What Makes Kubernetes Threat Hunting Unique
    • Threat Hunting Process
      • Hypothesis Generation
      • Investigation
      • Identification
      • Resolution & Follow Up
    • Pyramid of Pain
    • Threat Frameworks
      • MITRE Containers Matrix
        • MITRE Att&ck Concepts
        • MITRE Att&ck Data Sources
        • MITRE ATT&CK Mitigations
        • MITRE Att&ck Containers Matrix
      • Microsoft Threat for Kubernetes
    • Kubernetes Behavioral Analysis and Anomaly Detection
    • Threat Hunting Ideas
    • Threat Hunting Labs
  • Security Tools
    • Falco
      • Falco Overview
      • Falco's Architecture
      • Runtime Security Explained
      • Installation and Setup
      • Falco Rules
      • Tuning Falco Rules
      • Integrating Falco with Kubernetes
      • Detecting Common Threats with Falco
      • Integrating Falco with Other Security Tools
      • Automating Incident Response with Falco
      • Managing Falco Performance and Scalability
      • Updating and Maintaining Falco
      • Real-World Case Studies and Lessons Learned
      • Labs
        • Deploying Falco on a Kubernetes Cluster
        • Writing and Testing Custom Falco Rules
        • Integrating Falco with a SIEM System
        • Automating Responses to Falco Alerts
    • Open Policy Agent (OPA)
      • Introduction to Open Policy Agent (OPA)
      • Getting Started with OPA
      • Rego
      • Advanced Rego Concepts
      • Integrating OPA with Kubernetes
      • OPA Gatekeeper
      • Policy Enforcement in Microservices
      • OPA API Gateways
      • Introduction to CI/CD Pipelines and Policy Enforcement
      • External Data in OPA
      • Introduction to Decision Logging
      • OPA Performance Monitoring
      • OPA Implementation Best Practices
      • OPA Case Studies
      • OPA Ecosystem
    • Kube-Bench
    • Kube-Hunter
    • Trivy
    • Security Best Practices and Documentation
      • RBAC Good Practices
      • Official CVE Feed
      • Kubernetes Security Checklist
      • Securing a Cluster
      • OWASP
  • Open Source Tools
    • Cloud Native Computing Foundation (CNCF)
      • Security Projects
  • Infrastructure as Code
    • Kubernetes and Terraform
      • Key Focus Areas for Threat Hunters
      • Infastructure As Code: Kubernetes
      • Infrastructure as Code (IaC) Basics
      • Infastructure As Code Essential Commands
      • Terraform for Container Orchestration
      • Network and Load Balancing
      • Secrets Management
      • State Management
      • CI/CD
      • Security Considerations
      • Monitoring and Logging
      • Scaling and High Availability
      • Backup and Disaster Recovery
    • Helm
      • What is Helm?
      • Helm Architecture
      • Write Helm Charts
      • Using Helm Charts
      • Customizing Helm Charts
      • Customizing Helm Charts
      • Building Your Own Helm Chart
      • Advanced Helm Chart Customization
      • Helm Repositories
      • Helm Best Practices
      • Helmfile and Continuous Integration
      • Managing Secrets with Helm and Helm Secrets
      • Troubleshooting and Debugging Helm
      • Production Deployments
      • Helm Case Studies
Powered by GitBook
On this page
  • Configuring Minikube
  • 1. Customizing Resource Allocation
  • Step 1: Allocate CPU and Memory
  • Step 2: Adjust Disk Size
  • Step 3: Apply Configurations After Initial Setup
  • 2. Selecting Kubernetes Versions
  • Step 1: Specify Kubernetes Version
  • Step 2: Upgrade or Downgrade Kubernetes
  • 3. Configuring Minikube Addons
  • Step 1: List Available Addons
  • Step 2: Enable an Addon
  • Step 3: Disable an Addon
  • 4. Configuring the VM Driver
  • Step 1: Set the VM Driver
  • Step 2: View Available Drivers
  • 5. Persistent Configuration
  • Step 1: Save Configuration Options
  • Step 2: View Configuration
  • Step 3: Unset Configuration Options
  • Conclusion
  1. Kubernetes Fundamentals
  2. MiniKube

Configuring MiniKube

Configuring Minikube

In this lesson, we'll explore how to configure Minikube to suit your specific development or testing needs. Minikube offers a variety of customization options, including adjusting resource allocation, selecting Kubernetes versions, and enabling useful addons. By the end of this lesson, you’ll understand how to tailor Minikube’s settings to optimize performance and functionality.

1. Customizing Resource Allocation

Minikube allows you to configure the amount of CPU, memory, and disk space allocated to the virtual machine or container running your Kubernetes cluster. This is particularly useful if you're running resource-intensive applications or need to simulate a more realistic environment.

Step 1: Allocate CPU and Memory

  • You can specify the number of CPUs and the amount of memory when you start Minikube:

    minikube start --cpus=4 --memory=8192
    • Explanation:

      • --cpus=4: Allocates 4 CPU cores to the Minikube VM.

      • --memory=8192: Allocates 8GB of RAM to the Minikube VM.

Step 2: Adjust Disk Size

  • If you need more disk space, you can specify it using the --disk-size option:

    minikube start --disk-size=50g
    • Explanation:

      • --disk-size=50g: Allocates 50GB of disk space to the Minikube VM.

Step 3: Apply Configurations After Initial Setup

  • If you’ve already started Minikube and want to change the resource allocation, you’ll need to delete the existing Minikube instance and start it again with the new settings:

    minikube delete
    minikube start --cpus=4 --memory=8192 --disk-size=50g
    • Explanation:

      • minikube delete: Deletes the current Minikube instance.

      • minikube start: Starts a new instance with the specified resource allocation.

2. Selecting Kubernetes Versions

Minikube allows you to specify which version of Kubernetes you want to run. This is particularly useful for testing applications against different versions or ensuring compatibility with a specific Kubernetes release.

Step 1: Specify Kubernetes Version

  • You can select a specific Kubernetes version when starting Minikube:

    minikube start --kubernetes-version=v1.21.0
    • Explanation:

      • --kubernetes-version=v1.21.0: Specifies that Minikube should use Kubernetes version 1.21.0.

Step 2: Upgrade or Downgrade Kubernetes

  • If you need to upgrade or downgrade the Kubernetes version for an existing Minikube instance:

    minikube delete
    minikube start --kubernetes-version=v1.22.0
    • Explanation:

      • This process deletes the current Minikube instance and starts a new one with the specified Kubernetes version.

3. Configuring Minikube Addons

Minikube comes with a variety of addons that extend its functionality, such as the Kubernetes dashboard, metrics server, and Ingress controllers. These addons can be enabled or disabled as needed.

Step 1: List Available Addons

  • To see a list of all available addons:

    minikube addons list
    • Explanation:

      • This command lists all the addons that can be enabled or disabled in Minikube, along with their current status.

Step 2: Enable an Addon

  • To enable an addon, use the following command:

    minikube addons enable <addon-name>
    • Example: Enabling the metrics-server addon:

      minikube addons enable metrics-server
    • Explanation:

      • minikube addons enable: Command to enable a specific addon.

      • metrics-server: The name of the addon to enable, which allows Kubernetes to gather and display metrics like CPU and memory usage.

Step 3: Disable an Addon

  • If you no longer need a specific addon, you can disable it:

    minikube addons disable <addon-name>
    • Example: Disabling the metrics-server addon:

      minikube addons disable metrics-server
    • Explanation:

      • minikube addons disable: Command to disable a specific addon.

4. Configuring the VM Driver

Minikube supports various virtualization drivers, such as VirtualBox, Hyper-V, Docker, and KVM. The choice of driver depends on your operating system and specific use case.

Step 1: Set the VM Driver

  • You can specify which driver to use when starting Minikube:

    minikube start --driver=virtualbox
    • Explanation:

      • --driver=virtualbox: Specifies that VirtualBox should be used as the virtualization driver.

Step 2: View Available Drivers

  • To see which drivers are supported on your system:

    bashCopy codeminikube start --help | grep 'driver'
    • Explanation:

      • This command shows the list of supported drivers based on your system’s configuration.

5. Persistent Configuration

Minikube allows you to save configurations for future use, so you don’t have to specify them every time you start Minikube.

Step 1: Save Configuration Options

  • Use the minikube config command to set default options:

    bashCopy codeminikube config set memory 8192
    minikube config set cpus 4
    minikube config set kubernetes-version v1.22.0
    • Explanation:

      • These commands set the default memory, CPU, and Kubernetes version for future Minikube instances.

Step 2: View Configuration

  • To view the current configuration settings:

    bashCopy codeminikube config view
    • Explanation:

      • This command shows all the configuration options that have been set for Minikube.

Step 3: Unset Configuration Options

  • If you want to remove a specific configuration:

    bashCopy codeminikube config unset memory
    • Explanation:

      • This command removes the custom memory configuration, reverting to the default setting.

Conclusion

In this lesson, you've learned how to configure Minikube to optimize performance, select specific Kubernetes versions, enable useful addons, and persist configuration settings. These customization options allow you to tailor Minikube to your development and testing needs, making it a versatile tool for various Kubernetes use cases. In the next lesson, we’ll explore persistent storage in Minikube and how to manage data effectively within your local Kubernetes cluster.

PreviousManaging Kubernetes ResourcesNextPersistent Storage in Minikube

Last updated 9 months ago