sudo snap install --channel=1.18/stable --classic microk8s
sudo snap install --classic helm
Single host deployment
|
Warning
|
This deployment is only for learning and testing purposes. |
The following instructions will help you set up a standalone Kubernetes cluster with Microk8s to deploy SD Elements on an Ubuntu based system that supports snaps.
Requirements
Minimal specifcations to support a single-node Kubernetes cluster and SD Elements
Software
-
Ubuntu 18.04 LTS or newer
-
snapdpackage installed
-
Hardware
-
8 vCPU/cores
-
16 GB RAM
-
100 GB disk
Install Kubernetes (Microk8s v1.18.2 or later)
-
Install snaps
-
Add current user to
microk8sgroupsudo usermod -a -G microk8s "${USER}" && su - "${USER}" -
Enable required
microk8saddonsmicrok8s.enable dns dashboard storage ingress -
Configure
kubemicrok8s.kubectl config view --raw > "${HOME}/.kube/config" -
Ensure correct permissions on
kubeconfig file and directorychown "${USER}" "${HOME}/.kube" chown "${USER}" "${HOME}/.kube/config" chmod 750 "${HOME}/.kube" chmod 640 "${HOME}/.kube/config"
Configure and deploy SD Elements
-
See Helm for a guide on deploying, accessing, upgrading and undeploying SD Elements
-
See Configuration for a guide on configuring SD Elements
Access Microk8s Kubernetes Dashboard
-
For Microk8s versions 1.18 and earlier, you can directly access the Kubernetes API. Follow the instructions found under API Authentication (Microk8s versions 1.18 and earlier only).
-
For Microk8s versions later than 1.18, follow the instructions under Dashboard Proxy.
|
Note
|
The dashboard proxy needs to be enabled on microk8s to allow access. |
Dashboard Proxy
-
Create self signed kubernetes dashboard certificates
mkdir kube_certs openssl req -nodes -newkey rsa:2048 -keyout kube_certs/key.pem -out kube_certs/cert.pem -subj "/CN=kubernetes-dashboard" microk8s.kubectl --namespace kube-system delete secret/kubernetes-dashboard-certs microk8s.kubectl --namespace kube-system create secret generic kubernetes-dashboard-certs --from-file=./kube_certs # Verify certs are loaded then clean up local artifacts microk8s.kubectl --namespace kube-system describe secret/kubernetes-dashboard-certs rm -rf kube_certs
Connecting to Microk8s running locally
-
Start the kubernetes dashboard-proxy. Retrieve the token displayed on the terminal
microk8s.dashboard-proxy Checking if Dashboard is running. Dashboard will be available at https://127.0.0.1:10443 Use the following token to log in: <Dashboard Access Token>-
Follow the above instructions and browse here:
https://127.0.0.1:10443.
-
-
On the
Kubernetes Dashboardscreen, selectTokenand enter the access token listed above. -
Click
Sign in.
Connecting to Microk8s running remotely
-
If the microk8s instance is running in a remote server, start a kubectl proxy on your local server with the admin kubernetes config.
kubectl proxy -
Access the proxy log in here: http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#/login
-
Browse to the Kubernetes dashboard here:
https://127.0.0.1:10443.
-
-
On the
Kubernetes Dashboardscreen, selectTokenand enter it. -
Click
Sign in.
API Authentication (Microk8s versions 1.18 and earlier only)
If you are running microk8s versions 1.18 or earlier, you can access the dashboard directly via log in through the API:
-
Retrieve the Kubernetes
admincredentials:grep -E "username|password" ~/.kube/config -
Retrieve the Kubernetes token. Store the token name in a variable, then print token:
token="$(microk8s.kubectl -n kube-system get secret | \ grep default-token | \ cut -d " " -f1)" && microk8s.kubectl -n kube-system describe secret "${token}" | grep "token:" -
Browse to the Kubernetes dashboard with the following URL (same
IP_or_hostnameused to access SD Elements). Log in with the admin credentials.https://<IP_or_hostname>:16443/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/#/login-
Enter the
adminusername and password to log in when prompted. -
On the
Kubernetes Dashboardscreen, selectTokenand enter the token you saved earlier. -
Click
Sign in.
-
Common tasks
See the Common Tasks page for detailed information on tasks that you may need to perform to manage SD Elements.
|
Note
|
Remember to use the microk8s.kubectl command when you need to run kubectl in a single-host Microk8s deployment.
|