{"id":16553454,"url":"https://github.com/scalastic/local-k8s-installation","last_synced_at":"2025-09-23T03:08:19.059Z","repository":{"id":88985073,"uuid":"357575912","full_name":"scalastic/local-k8s-installation","owner":"scalastic","description":"✨ How to install locally Kubernetes, Dashboard, Metrics-Server, Kube-State-Metrics, Prometheus, and Grafana... on MacOS ✨","archived":false,"fork":false,"pushed_at":"2021-04-16T23:15:12.000Z","size":1004,"stargazers_count":3,"open_issues_count":0,"forks_count":4,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-12T03:54:00.698Z","etag":null,"topics":["dashboard","docker-desktop","docker-desktop-for-mac","grafana","grafana-dashboard","kube-state-metrics","kubernetes","kubernetes-setup","macos","macosx","metrics-server","prometheus"],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/scalastic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-13T14:07:25.000Z","updated_at":"2023-10-26T09:37:05.000Z","dependencies_parsed_at":"2023-06-13T10:45:25.503Z","dependency_job_id":null,"html_url":"https://github.com/scalastic/local-k8s-installation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalastic%2Flocal-k8s-installation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalastic%2Flocal-k8s-installation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalastic%2Flocal-k8s-installation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/scalastic%2Flocal-k8s-installation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/scalastic","download_url":"https://codeload.github.com/scalastic/local-k8s-installation/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248514205,"owners_count":21116899,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dashboard","docker-desktop","docker-desktop-for-mac","grafana","grafana-dashboard","kube-state-metrics","kubernetes","kubernetes-setup","macos","macosx","metrics-server","prometheus"],"created_at":"2024-10-11T19:48:15.382Z","updated_at":"2025-09-23T03:08:14.015Z","avatar_url":"https://github.com/scalastic.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Locally install Kubernetes with essential components\n\n\u003e \n\u003e This procedure is working on macOS indeed - and it's a great deal. Hope this work on others systems with some \n\u003e modification, but I can't guarantee.\n\n\u003e\n\u003e I kept all YAML configuration files in the [k8s](k8s) directory. I will specify where they come from and\n\u003e what modification has been included when necessary.\n\n\n## Kubernetes\n\n* I'm using `Docker for Desktop` which you can find obviously at https://www.docker.com/products/docker-desktop\n\n  ![Docker for Desktop](img/docker-desktop.png)\n\n* After installation, you can grapple basic information from your cluster:\n\n```shell\n% kubectl cluster-info\n```\n```shell\n% kubectl get ns\n``` \n\n- Or even:\n  \n```shell\n% kubectl get all -A\n```\n\u003e **Note the `-A`**\n\u003e \n\u003e Since Kube `1.14`, we don't have to use the `--all-namespaces` anymore! So don't...\n\n\n## Kubernetes Dashboard\n\n`Dashboard` is a web UI of k8s API and provide an easy way to visualize and debug things:\n  https://github.com/kubernetes/dashboard\n  \n\n### Installation\n\nBy default, `Dashboard` is protected by a token, and each time you'll access it, you'll be asked to provide one. It could \nreally be annoying in the long run. Fortunately, `Kubernetes Dashboard` allows you to bypass the login page by adding `--enable-skip-login` to the \nconfiguration.\n\n\u003e The repository configuration file is patched with this instruction (line 198) \n\n\u003e Obviously this is only for local platform!\n\nTo deploy `Dashboard` - with no authentication - execute the following command:\n```\n% kubectl apply -f ./k8s/dashboard-v2.2.0-recommended.yaml\n```\nThen access your dashboard from your local workstation by creating a secure channel to your Kubernetes cluster. To do \nso, run the following command:\n```\n% kubectl proxy\n```\nThe address is now:\n\nhttp://localhost:8001/api/v1/namespaces/kubernetes-dashboard/services/https:kubernetes-dashboard:/proxy/\n\n\u003e Don't forget to bookmark the URL!\n\nYou'll see this login page at first:\n\n![Dashboard first Access page](img/dashboard-first-access.jpg)\n\nJust push the `skip` button to bypass authentication.\n\n![Dashboard index page](img/dashboard-index.jpg)\n\n## Metrics-Server\n\n`Metrics-Server` is used to crop metrics from k8s components and expose them to k8s API:\n  https://github.com/kubernetes-sigs/metrics-server\n\n`Metrics Server` serves the goals of core metrics pipelines: CPU and RAM. It's a cluster level component which \nperiodically scrapes metrics from all Kubernetes nodes served by Kubelet. When installed, Kubernetes Dashboard displays\nthis metrics.\n\nTo allow `Metrics Server` to collect its data over https, the original script has been modified to accept insecure TLS\nconnections by adding `- --kubelet-insecure-tls` at line 133.\n\n\u003e Once again, don't do this on your public servers!\n\nApply the configuration by entering :\n```\n% kubectl apply -f k8s/metrics-server-components-v0.4.2.yaml\n```\n\nWhen reloading the Dashboard, you should now see CPU and Memory Usages 🌈\n\nYou can try the `Pods` section, that's my favorite! \n\n![Dashboard with metrics page](img/dashboard-with-metrics.jpg)\n\n## Kube State Metrics\n\nUnlike Metrics Server, `Kube State Metrics` is focused on generating numerous metrics from Kubernetes' object state \n(e.g. metrics based on deployments, replica sets, pods, etc.). It holds an entire snapshot of Kubernetes state in memory\nand generates new metrics based off of it.\n\nHaving `Kube State Metrics` enables access to these metrics from monitoring systems such as `Prometheus`.\n\nTo install Kube State Metrics, launch the following:\n```\n% kubectl apply -f k8s/kube-state-metrics-v2.0.0-rc.1.yaml\n```\n\n## Prometheus\n\nAs specified in the documentation, *Metrics Server* is useful for:\n\n- CPU/Memory based horizontal autoscaling\n- Automatically adjusting/suggesting resources needed by containers\n\nBut when its comes to:\n\n- Have an accurate source of resource usage metrics\n- Manage Horizontal autoscaling based on other resources than CPU/Memory\n\nYou should check out full monitoring solutions like `Prometheus` \n[https://prometheus.io](https://prometheus.io).\n\nIn a few words, `Prometheus` is a monitoring and alerting system which:\n- Collects data identified by a metric name\n- Stores time-series in memory and on local disk for efficiency\n- Allows notifications and alerting depending on data queries\n\n### Installation\n\nPrometheus' maintainers provide binaries and Docker images for `Prometheus` components. \nWith a bit of elbow grease, it is possible to create a k8s configuration file with everything we need:\n- Access to resources we want to monitor at cluster level\n- Role dedicated to Prometheus\n- Prometheus executable configuration\n- Docker image deployment\n- Exposition through service\n- And some specific paths due to Docker Desktop for Mac! 🥵\n\nTo run the `Prometheus` configuration, run the command:\n```\n% kubectl apply -f k8s/prometheus.yaml\n```\n\nYou can now access `Prometheus` interface at:\n[http://localhost:30000/](http://localhost:30000/)... but wait and see!!\n\n## Grafana\n\n`Grafana` [https://grafana.com/grafana/](https://grafana.com/grafana/) allows you to « *query, visualize and alert on \nmetrics through a powerful user interface* » as the site puts.\n\nIn practice, you will develop your query in `Prometheus`, and when you're satisfied with, run on `Grafana` to \nmonitor your service.\n\nAs you can see, the `Grafana` graphical interface offers numerous possibilities:\n\n![L'interface Grafana](img/grafana-ui.png)\n\nTo install Grafana, run the command:\n```\n% kubectl apply -f k8s/grafana-datasource.yaml\n% kubectl apply -f k8s/grafana.yaml\n```\n\nGrafana will be listening on [http://localhost:3000](http://localhost:3000). The default login is \"admin\" / \"admin\".\n\n\u003e Note:\n\u003e \n\u003e Configuring a dashboard in Grafana could be long, costly, and time-consuming. Collecting metrics depends on your host, \nVM/Virtualization Framework and the OS on your pod.\n\nYou own a Mac, you're running Docker Desktop and have followed this guide : you can import this \n[dashboard](./k8s/Docker Desktop Kubernetes All-in-one-1618321310777.json) right now to start monitoring your K8S cluster!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalastic%2Flocal-k8s-installation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fscalastic%2Flocal-k8s-installation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fscalastic%2Flocal-k8s-installation/lists"}