DEV Community

neil wu
neil wu

Posted on

Building a functional kubernate cluster with docker desktop on windows 11 pro

Installation the latest docker desktop

Download the docker desktop binary from https://docs.docker.com/desktop/setup/install/windows-install/ for your windows 11 Pro, then follow the instruction to install the application.

Configuration the installed docker desktop

  • Enable the host networking
    Settings -> Resources -> Network
    Enable host networking

  • Enable the kubernates
    Settings -> Kubernates -> Enable Kubernates

  • Create a single node kubernate cluster
    Settings -> Kubernates -> Cluster settings -> Kubeadm
    Click apply to create a single node cluster

  • Check created cluster

kubectl cluster-info

Kubernetes control plane is running at https://kubernetes.docker.internal:6443
CoreDNS is running at https://kubernetes.docker.internal:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump
Enter fullscreen mode Exit fullscreen mode

Deploy a cassandra to the cluster

  • Create a deployment yaml file
apiVersion: apps/v1
kind: Deployment
metadata:
  name: cassandra
  labels:
    app: cassandra
spec:
  replicas: 1
  selector:
    matchLabels:
      app: cassandra
  template:
    metadata:
      labels:
        app: cassandra
    spec:
      containers:
      - name: cassandra
        image: cassandra:4.1
        ports:
        - containerPort: 9042
        env:
        - name: CASSANDRA_CLUSTER_NAME
          value: "CassandraCluster"
        - name: MAX_HEAP_SIZE
          value: "512M"ply -
        - name: HEAP_NEWSIZE
          value: "100M"
        volumeMounts:
        - name: cassandra-data
          mountPath: /var/lib/cassandra
      volumes:
      - name: cassandra-data
        emptyDir: {}


Enter fullscreen mode Exit fullscreen mode
  • Deploy cassandra from a deployment yaml file kubectl apply -f cassandra.yaml After successfully executes the above command, check if cassandra pod is up and running.

kubectl get pods

neilwu@A8:~/apps/kubernates/deployment$ kubectl get pods
NAME                         READY   STATUS    RESTARTS   AGE
cassandra-6bfbff8548-qd8n7   1/1     Running   0          25m

Enter fullscreen mode Exit fullscreen mode

Excellent !, your first cassandra pod is up and running.

Top comments (0)