Last active
August 6, 2020 12:08
-
-
Save jayunit100/694d18fdd03837ee98d592af9c170e9a 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Notes to self:
Run on mac:
If following the kind setup instructions:
Following these instructions
To create a cluster from Kubernetes source:
Kind hacking
Run from a version of kubernetes other than master:
Look at what's going on inside the control plane:
Look at what's going on in Docker: