Forked from jayunit100/gist:694d18fdd03837ee98d592af9c170e9a
Created
August 6, 2020 12:08
-
-
Save mattfenwick/96bd79721e242c87f6b7810b970a436e to your computer and use it in GitHub Desktop.
hacking metrics into kubeadm
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
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
get a linux vm with 4 cores, 16 GB of RAM and use it for development
- can ssh into it
Follow along with KinD CI here
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What does this put into the image?
Maybe (?) -- need to verify: