Docker Desktop

Connect Infra App to your local Kubernetes cluster in Docker Desktop

Prerequisites

Enable Kubernetes

Access Docker Desktop preferences by click on the Docker Desktop menu bar icon and then Preferences...

Navigate to Kubernetes in the sidebar, then click Enable Kubernetes. Finally click Apply & Restart

Connect Infra App

Infra App will automatically work with Docker Desktop. Simply open it by clicking on the Cluster Switcher and then choosing docker-desktop:

Voila! Infra App is now connected to Docker Desktop's Kubernetes cluster:

Installing Metrics Server

Metrics server isn't included with Docker Desktop's installation of Kubernetes, and the default metrics-server setup guide won't work out of the box. Follow the steps below to install metrics server:

Download the latest components.yaml file from https://github.com/kubernetes-sigs/metrics-server/releases and open it in your text editor.

Then, add the line --kubelet-insecure-tls under the args: section:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: metrics-server
  namespace: kube-system
  labels:
    k8s-app: metrics-server
spec:
  selector:
    matchLabels:
      k8s-app: metrics-server
  template:
    metadata:
      name: metrics-server
      labels:
        k8s-app: metrics-server
    spec:
      serviceAccountName: metrics-server
      volumes:
      # mount in tmp so we can safely use from-scratch images and/or read-only containers
      - name: tmp-dir
        emptyDir: {}
      containers:
      - name: metrics-server
        image: k8s.gcr.io/metrics-server-amd64:v0.3.6
        imagePullPolicy: IfNotPresent
        args:
          - --cert-dir=/tmp
          - --secure-port=4443
          - --kubelet-insecure-tls # Add this line
        ports:
        - name: main-port
          containerPort: 4443
          protocol: TCP
        securityContext:
          readOnlyRootFilesystem: true
          runAsNonRoot: true
          runAsUser: 1000
        volumeMounts:
        - name: tmp-dir
          mountPath: /tmp
      nodeSelector:
        kubernetes.io/os: linux
        kubernetes.io/arch: "amd64"

Warning: This setting should only be used for the local Docker Desktop Kubernetes cluster, and not recommended for any hosted or production clusters.

Last, apply the modified components.yaml config file to your cluster.

kubectl apply -f components.yaml

Last updated