Skip to content

Local Kubernetes cluster setup workflow

Local Kubernetes cluster setup workflow refers to the process of deploying a functional Kubernetes cluster on a local machine for development and testing purposes^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

Due to the rapid pace of Kubernetes updates and API deprecations, often occurring quarterly, relying on older tutorials can lead to failure^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。As modern backend development increasingly relies on container orchestration for load balancing, auto-scaling, and managing diverse databases, establishing a local environment is a critical foundation for learning and application^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

Tools and Environment

While several tools exist for setting up a local cluster (such as Minikube), a common approach for macOS users involves utilizing the integrated Kubernetes support within Docker Desktop^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

The following workflow is validated on: * Software: Docker Desktop 4.8.1 (78998) * Kubernetes Version: v1.24.0 * Platform: macOS^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]

Installation Workflow

1. Installation of Docker Desktop

  1. Download: Acquire the installation package (.dmg) from the official Docker website^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。
  2. Setup: Drag Docker.app into the macOS Applications folder^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。
  3. Launch: Open the application to complete the basic installation^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

2. Enabling Kubernetes

Docker Desktop provides a built-in toggle to activate the Kubernetes components: 1. Access the Settings menu via the Docker Desktop dashboard. 2. Navigate to the Kubernetes tab. 3. Check the Enable Kubernetes option. 4. Click Apply & Restart^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

Note: This process triggers the download and installation of necessary container images, which may take some time^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

3. Verification

Once the installation completes, the Kubernetes indicator within Docker Desktop should turn green, signifying that the cluster control plane and associated containers are running^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

To verify functionality via the command line interface:

  • Check Cluster Info:

    [kubectl cluster-info](<./kubectl-cluster-info.md>)
    
    ^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]

  • List Nodes:

    [kubectl](<./kubectl.md>) get nodes
    
    ^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]

  • Check Version:

    [kubectl](<./kubectl.md>) version --short
    
    ^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]

Considerations

  • API Deprecation: Because Kubernetes releases frequent updates (often every three months), specific API functionalities may change. It is recommended to consult the latest documentation or source code when troubleshooting issues found in older tutorials^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。
  • Architecture Necessity: As backend architectures grow to involve multiple languages, frameworks, and databases (relational, non-relational, caching), simple containerization is often insufficient. A container management layer like Kubernetes is required to effectively manage these complex services^[400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md]。

Sources

  • 400-devops__06-Kubernetes__k8s-ithelp__Day4__README.md