Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save mattfenwick/96bd79721e242c87f6b7810b970a436e to your computer and use it in GitHub Desktop.
Save mattfenwick/96bd79721e242c87f6b7810b970a436e to your computer and use it in GitHub Desktop.
hacking metrics into kubeadm
10226 # 1) import components-base into the kubeadm package
10227 # 2) add a few metrics as is done in vi pkg/kubelet/metrics/metrics.go
10228 # 3) run "make kubeadm"
10229 # 4) run "kubeadm init" on your mac
10230 # 5) like this .//_output/local/go/bin/kubeadm init
diff --git a/cmd/kubeadm/app/kubeadm.go b/cmd/kubeadm/app/kubeadm.go
index 1842cfd8cb4..0ab66a1cadb 100644
--- a/cmd/kubeadm/app/kubeadm.go
+++ b/cmd/kubeadm/app/kubeadm.go
@@ -26,6 +26,24 @@ import (
cliflag "k8s.io/component-base/cli/flag"
"k8s.io/kubernetes/cmd/kubeadm/app/cmd"
+
+ "k8s.io/component-base/metrics"
+// "k8s.io/component-base/metrics/legacyregistry"
+
+)
+
+
+var (
+ // NodeName is a Gauge that tracks the ode's name. The count is always 1.
+ _ = metrics.NewGaugeVec(
+ &metrics.GaugeOpts{
+ Subsystem: "kubeadm",
+ Name: "a",
+ Help: "The node's name. The count is always 1.",
+ StabilityLevel: "1",
+ },
+ []string{"a"},
+ )
)
// Run creates and executes new kubeadm command
@mattfenwick
Copy link
Author

What does this put into the image?

Maybe (?) -- need to verify:

  • kubelet
  • api-server
  • scheduler
  • controller-manager

@mattfenwick
Copy link
Author

To build the kind node-image from source:

  • kind build node-image --kube-root=/tmp/kubernetes

Instead of using KinD, could also get a linux laptop and:

  • git clone kubernetes
  • hack/local-up-cluster.sh

@mattfenwick
Copy link
Author

get a linux vm with 4 cores, 16 GB of RAM and use it for development

  • can ssh into it

@mattfenwick
Copy link
Author

Follow along with KinD CI here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment