Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/olge404/microk8s
Install and setup a local, one-node kubernetes environment for development and test purposes with Microk8s and Ansible on ubuntu.
https://github.com/olge404/microk8s
kubernetes kubernetes-cluster microk8s
Last synced: about 2 months ago
JSON representation
Install and setup a local, one-node kubernetes environment for development and test purposes with Microk8s and Ansible on ubuntu.
- Host: GitHub
- URL: https://github.com/olge404/microk8s
- Owner: OlGe404
- License: gpl-3.0
- Created: 2020-12-31T14:47:39.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2024-11-11T22:17:37.000Z (about 2 months ago)
- Last Synced: 2024-11-11T23:23:53.956Z (about 2 months ago)
- Topics: kubernetes, kubernetes-cluster, microk8s
- Language: Shell
- Homepage:
- Size: 185 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Dei: deinstall.yaml
Awesome Lists containing this project
README
# Microk8s
This repo can be used to setup a local kubernetes installation based on microk8s.
Checkout https://microk8s.io/ for more.## Prerequisites
For general prerequisites of microk8s, see https://microk8s.io/docs/getting-started.Run
./prerequisites.sh
to install the prerequisites for this repo.## Install
After you've installed the prerequisites, run:
*ansible-playbook install.yaml
* Refresh your shell withsu - $(whoami)
* Ensure the client and aliases work withmkctl get pods --all-namespaces
**Note:** If passwordless sudo is disabled, force ansible to ask for the sudo password
by appending-K
to theansible-playbook install.yaml
command.### Kubernetes-Dashboard
The kubernetes-dashboard will be installed in microk8s using the [official helm chart](https://artifacthub.io/packages/helm/k8s-dashboard/kubernetes-dashboard).
We don't use the dashboard add-on to be able to access the dashboard without using a port-forward/proxy command.
The dashboard will be available athttp://localhost:30001
after installation.You can retrieve the login token for the dashboard with
microk8s kubectl get secret kubernetes-dashboard-admin-token -n kubernetes-dashboard -o jsonpath={'.data.token'} | base64 -d | awk '{print $1}'
.### Work with microk8s
Microk8s will be up and running when the installation was done, but it won't be added to your systems autostart.
To start microk8s, run `microk8s start && microk8s status --wait-ready`.
It can take some time for all services to be up and running, even after the command returns.To stop microk8s, run `microk8s stop`. See `microk8s help` for a list of all available subcommands.
The kubeconfig file to interact with microk8s will be created at
~/.kube/microk8s
and an alias will be created automatically to setexport KUBECONFIG=~/.kube/microk8s
on shell login. If you don't want that, append-e microk8s_manage_kubeconfig=false
to theansible-playbook install.yaml
command.Microk8s is bundled with the kubectl cli. If you don't have kubectl installed, or you only want to use it in the microk8s context,
append-e microk8s_manage_kubectl=true
to create thekubectl='microk8s kubectl'
alias.### Aliases
The playbook creates aliases to ease the usage of `microk8s` and `microk8s kubectl` commands.
It also exports the `KUBECONFIG` ENV so you can work with other clients like oc/kubectl/helm as usual in the microk8s context.The following aliases are created:
| Alias | Command | Notes |
| ----- | --------------------------------------------------------------- | ------------------------------------------------------------------------------------ |
| mk8s | `microk8s` | For commands controlling microk8s itself, e.g. `mk8s start` or `mk8s stop` |
| mkctl | `microk8s kubectl` | To run kubectl commands with the included binary, e.g. `mkctl get services` |
| mkns | `microk8s kubectl config set-context microk8s --namespace ` | To set a namespace for subsequent microk8s kubectl commands, e.g. `mkns kube-system` |
| mktoken |microk8s kubectl get secret kubernetes-dashboard-admin-token -n kubernetes-dashboard -o jsonpath={'.data.token'} \| base64 -d \| awk '{print $1}'
| Get the login token for the kubernetes-dashboard |## Deinstall
To deinstall microk8s, runansible-playbook deinstall.yaml
.
If passwordless sudo is disabled, runansible-playbook deinstall.yaml -K
instead.