feat: add yakd addon
Add an addon for automatically setting up [YAKD (Yet Another Kubernetes Dashboard)](https://github.com/manusa/yakd) This is an alternative Kubernetes Dashboard with special support for Minikube, OpenShift, and other flavors of Kubernetes. It was originally started as an example project for [YAKC (Yet Another Kubernetes Client)](https://github.com/manusa/yakc) but it was recently spun off as a separate project. Regarding Minikube, it offers specific functionality such as cluster detection, support for opening NodePort services from the interface, and more.pull/17775/head
parent
3b15b42c10
commit
0078ccddd6
|
@ -170,4 +170,8 @@ var (
|
||||||
// NvidiaDevicePlugin assets for nvidia-device-plugin addon
|
// NvidiaDevicePlugin assets for nvidia-device-plugin addon
|
||||||
//go:embed nvidia-device-plugin/*.tmpl
|
//go:embed nvidia-device-plugin/*.tmpl
|
||||||
NvidiaDevicePlugin embed.FS
|
NvidiaDevicePlugin embed.FS
|
||||||
|
|
||||||
|
// YakdAssets assets for yakd addon
|
||||||
|
//go:embed yakd/*.yaml yakd/*.tmpl
|
||||||
|
YakdAssets embed.FS
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,16 @@
|
||||||
|
apiVersion: rbac.authorization.k8s.io/v1
|
||||||
|
kind: ClusterRoleBinding
|
||||||
|
metadata:
|
||||||
|
name: yakd-dashboard
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
kubernetes.io/minikube-addons: yakd-dashboard
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
|
roleRef:
|
||||||
|
apiGroup: rbac.authorization.k8s.io
|
||||||
|
kind: ClusterRole
|
||||||
|
name: cluster-admin
|
||||||
|
subjects:
|
||||||
|
- kind: ServiceAccount
|
||||||
|
name: yakd-dashboard
|
||||||
|
namespace: yakd-dashboard
|
|
@ -0,0 +1,69 @@
|
||||||
|
kind: Deployment
|
||||||
|
apiVersion: apps/v1
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
app.kubernetes.io/instance: yakd-dashboard
|
||||||
|
kubernetes.io/minikube-addons: yakd-dashboard
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
|
name: yakd-dashboard
|
||||||
|
namespace: yakd-dashboard
|
||||||
|
spec:
|
||||||
|
replicas: 1
|
||||||
|
revisionHistoryLimit: 10
|
||||||
|
selector:
|
||||||
|
matchLabels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
app.kubernetes.io/instance: yakd-dashboard
|
||||||
|
template:
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
app.kubernetes.io/instance: yakd-dashboard
|
||||||
|
gcp-auth-skip-secret: "true"
|
||||||
|
spec:
|
||||||
|
containers:
|
||||||
|
- name: yakd
|
||||||
|
image: {{.CustomRegistries.Yakd | default .ImageRepository | default .Registries.Yakd }}{{.Images.Yakd}}
|
||||||
|
imagePullPolicy: IfNotPresent
|
||||||
|
ports:
|
||||||
|
- name: http
|
||||||
|
containerPort: 8080
|
||||||
|
protocol: TCP
|
||||||
|
env:
|
||||||
|
- name: KUBERNETES_NAMESPACE
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: metadata.namespace
|
||||||
|
- name: HOSTNAME
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: metadata.name
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
memory: 256Mi
|
||||||
|
requests:
|
||||||
|
memory: 128Mi
|
||||||
|
securityContext:
|
||||||
|
allowPrivilegeEscalation: false
|
||||||
|
privileged: false
|
||||||
|
runAsUser: 1001
|
||||||
|
runAsGroup: 2001
|
||||||
|
livenessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
timeoutSeconds: 10
|
||||||
|
readinessProbe:
|
||||||
|
httpGet:
|
||||||
|
path: /
|
||||||
|
port: 8080
|
||||||
|
initialDelaySeconds: 10
|
||||||
|
timeoutSeconds: 10
|
||||||
|
restartPolicy: Always
|
||||||
|
serviceAccountName: yakd-dashboard
|
||||||
|
nodeSelector:
|
||||||
|
"kubernetes.io/os": linux
|
|
@ -0,0 +1,7 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: Namespace
|
||||||
|
metadata:
|
||||||
|
name: yakd-dashboard
|
||||||
|
labels:
|
||||||
|
kubernetes.io/minikube-addons: yakd-dashboard
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
|
@ -0,0 +1,9 @@
|
||||||
|
apiVersion: v1
|
||||||
|
kind: ServiceAccount
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
kubernetes.io/minikube-addons: yakd-dashboard
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
|
name: yakd-dashboard
|
||||||
|
namespace: yakd-dashboard
|
|
@ -0,0 +1,17 @@
|
||||||
|
kind: Service
|
||||||
|
apiVersion: v1
|
||||||
|
metadata:
|
||||||
|
labels:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
kubernetes.io/minikube-addons: yakd-dashboard
|
||||||
|
addonmanager.kubernetes.io/mode: Reconcile
|
||||||
|
name: yakd-dashboard
|
||||||
|
namespace: yakd-dashboard
|
||||||
|
spec:
|
||||||
|
type: NodePort
|
||||||
|
ports:
|
||||||
|
- port: 80
|
||||||
|
targetPort: 8080
|
||||||
|
selector:
|
||||||
|
app.kubernetes.io/name: yakd-dashboard
|
||||||
|
app.kubernetes.io/instance: yakd-dashboard
|
|
@ -150,6 +150,12 @@ kubectl get secret $SECRET --namespace headlamp --template=\{\{.data.token\}\} |
|
||||||
minikube{{.profileArg}} addons enable metrics-server
|
minikube{{.profileArg}} addons enable metrics-server
|
||||||
|
|
||||||
`, out.V{"profileArg": tipProfileArg})
|
`, out.V{"profileArg": tipProfileArg})
|
||||||
|
case "yakd":
|
||||||
|
out.Styled(style.Tip, `To access YAKD - Kubernetes Dashboard, wait for Pod to be ready and run the following command:
|
||||||
|
|
||||||
|
minikube service yakd-dashboard -n yakd-dashboard
|
||||||
|
|
||||||
|
`)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -232,4 +232,9 @@ var Addons = []*Addon{
|
||||||
set: SetBool,
|
set: SetBool,
|
||||||
callbacks: []setFn{EnableOrDisableAddon},
|
callbacks: []setFn{EnableOrDisableAddon},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "yakd",
|
||||||
|
set: SetBool,
|
||||||
|
callbacks: []setFn{EnableOrDisableAddon},
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|
|
@ -787,6 +787,19 @@ var Addons = map[string]*Addon{
|
||||||
}, map[string]string{
|
}, map[string]string{
|
||||||
"NvidiaDevicePlugin": "nvcr.io",
|
"NvidiaDevicePlugin": "nvcr.io",
|
||||||
}),
|
}),
|
||||||
|
"yakd": NewAddon([]*BinAsset{
|
||||||
|
MustBinAsset(addons.YakdAssets, "yakd/yakd-ns.yaml", vmpath.GuestAddonsDir, "yakd-ns.yaml", "0640"),
|
||||||
|
MustBinAsset(addons.YakdAssets, "yakd/yakd-sa.yaml", vmpath.GuestAddonsDir, "yakd-sa.yaml", "0640"),
|
||||||
|
MustBinAsset(addons.YakdAssets, "yakd/yakd-crb.yaml", vmpath.GuestAddonsDir, "yakd-crb.yaml", "0640"),
|
||||||
|
MustBinAsset(addons.YakdAssets, "yakd/yakd-svc.yaml", vmpath.GuestAddonsDir, "yakd-svc.yaml", "0640"),
|
||||||
|
MustBinAsset(addons.YakdAssets, "yakd/yakd-dp.yaml.tmpl", vmpath.GuestAddonsDir, "yakd-dp.yaml", "0640"),
|
||||||
|
}, false, "yakd", "3rd party (marcnuri.com)", "manusa", "https://minikube.sigs.k8s.io/docs/handbook/addons/yakd/",
|
||||||
|
map[string]string{
|
||||||
|
"Yakd": "marcnuri/yakd:0.0.3@sha256:ebb5a2378be98b0674e5fb123b37812c5f2108791bfe3a1f579bf71718eac63b",
|
||||||
|
},
|
||||||
|
map[string]string{
|
||||||
|
"Yakd": "docker.io",
|
||||||
|
}),
|
||||||
}
|
}
|
||||||
|
|
||||||
// parseMapString creates a map based on `str` which is encoded as <key1>=<value1>,<key2>=<value2>,...
|
// parseMapString creates a map based on `str` which is encoded as <key1>=<value1>,<key2>=<value2>,...
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
---
|
||||||
|
title: "Using the YAKD - Kubernetes Dashboard Addon"
|
||||||
|
linkTitle: "YAKD - Kubernetes Dashboard"
|
||||||
|
weight: 1
|
||||||
|
date: 2023-12-12
|
||||||
|
---
|
||||||
|
|
||||||
|
## YAKD - Kubernetes Dashboard Addon
|
||||||
|
|
||||||
|
[YAKD - Kubernetes Dashboard](https://github.com/manusa/yakd) is a full-featured web-based Kubernetes Dashboard with special functionality for Minikube.
|
||||||
|
|
||||||
|
The dashboard features a real-time Search pane that allows you to search for Kubernetes resources and see them update in real-time as you type.
|
||||||
|
|
||||||
|
### Enable YAKD - Kubernetes Dashboard on minikube
|
||||||
|
|
||||||
|
To enable this addon, simply run:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
minikube addons enable yakd
|
||||||
|
```
|
||||||
|
|
||||||
|
Once the addon is enabled, you can access the YAKD - Kubernetes Dashboard's web UI using the following command.
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
minikube service yakd-dashboard -n yakd-dashboard
|
||||||
|
```
|
||||||
|
|
||||||
|
There dashboard will open in a new browser window and you should be able to start using it with no further hassle.
|
||||||
|
|
||||||
|
YAKD - Kubernetes Dashboard is also compatible with metrics-server. To install it, run:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
minikube addons enable metrics-server
|
||||||
|
```
|
||||||
|
|
||||||
|
### Disable YAKD - Kubernetes Dashboard
|
||||||
|
|
||||||
|
To disable this addon, simply run:
|
||||||
|
|
||||||
|
```shell script
|
||||||
|
minikube addons disable yakd
|
||||||
|
```
|
|
@ -134,6 +134,7 @@ func TestAddons(t *testing.T) {
|
||||||
{"CloudSpanner", validateCloudSpannerAddon},
|
{"CloudSpanner", validateCloudSpannerAddon},
|
||||||
{"LocalPath", validateLocalPathAddon},
|
{"LocalPath", validateLocalPathAddon},
|
||||||
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
|
{"NvidiaDevicePlugin", validateNvidiaDevicePlugin},
|
||||||
|
{"Yakd", validateYakdAddon},
|
||||||
}
|
}
|
||||||
for _, tc := range tests {
|
for _, tc := range tests {
|
||||||
tc := tc
|
tc := tc
|
||||||
|
@ -955,3 +956,16 @@ func validateNvidiaDevicePlugin(ctx context.Context, t *testing.T, profile strin
|
||||||
t.Errorf("failed to disable nvidia-device-plugin: args %q : %v", rr.Command(), err)
|
t.Errorf("failed to disable nvidia-device-plugin: args %q : %v", rr.Command(), err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func validateYakdAddon(ctx context.Context, t *testing.T, profile string) {
|
||||||
|
defer PostMortemLogs(t, profile)
|
||||||
|
|
||||||
|
rr, err := Run(t, exec.CommandContext(ctx, Target(), "addons", "enable", "yakd", "-p", profile, "--alsologtostderr", "-v=1"))
|
||||||
|
if err != nil {
|
||||||
|
t.Fatalf("failed to enable yakd addon: args: %q: %v", rr.Command(), err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := PodWait(ctx, t, profile, "yakd-dashboard", "app.kubernetes.io/name=yakd-dashboard", Minutes(2)); err != nil {
|
||||||
|
t.Fatalf("failed waiting for YAKD - Kubernetes Dashboard pod: %v", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue