dlipovetsky / kubecon-eu-2023-demo

Breakpoints in Your Pod - KubeCon EU 2023

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Breakpoints in Your Pod Demo

Install dependencies

First, you'll need to install VS Code.

Also, make sure you have these utilities:

  • bash
  • command
  • curl
  • docker
  • git
  • sed
  • timeout
  • xargs

Run this to install remaining dependencies:

bash 01-install-dependencies.sh

Prepare the minikube cluster

bash 02-prepare-cluster.sh

Patch Cluster API Deployments

bash 03-patch-deployments.sh

Create debugger containers

bash 04-create-debugger-container.sh

Start debug servers

bash 05-start-debug-servers.sh

Configure the Go root used for the demo

sed "s|__REPO_ROOT_DIR__|$PWD/go|g" vscode-files/demo.code-workspace.tmpl > vscode-files/demo.code-workspace

Start VS Code

Open the Cluster API workspace:

code vscode-files/demo.code-workspace

Install the vscode-go Extension

Follow the official instructions.

Set breakpoints

Open VS Code to these lines, and set breakpoints:

code --goto cluster-api/bootstrap/kubeadm/internal/controllers/kubeadmconfig_controller.go:521
code --goto cluster-api/internal/controllers/machine/machine_controller_noderef.go:91
code --goto infrastructure/docker/internal/docker/machine.go:232

Connect to the debug servers in the 3 Pods

Use the VS Code debug UI to "run and debug" each of three launch configurations.

Scale worker machines up by 1

bin/kubectl patch cluster capi-quickstart --type json --patch '[{"op": "replace", "path": "/spec/topology/workers/machineDeployments/0/replicas",  "value": 1}]'

Step through the code

About

Breakpoints in Your Pod - KubeCon EU 2023

License:Apache License 2.0


Languages

Language:Shell 95.1%Language:Dockerfile 4.9%