In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article is about how to install MicroK8s 1.20.2 based on Ubuntu 20.04. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
MicroK8s is the smallest and fastest cluster system that is fully compatible with Kubernetes. It is mainly used for workstations and small teams. However, the image is not packaged with snap and is still on gcr.io. There are still problems with domestic downloads. MicroK8s is suitable for offline development, prototyping, and testing, especially running VM as a small, cheap, reliable k8s for CI/CD. It supports arm architecture and is also suitable for developing IoT applications, which can be deployed to small Linux devices through MicroK8s.
1. Install MicroK8s
Install via snap:
Sudo snap install microk8s-classic
Give it a try:
The microk8s status# output is as follows: microk8s is runninghigh-availability: no datastore master nodes: 127.0.0.1 datastore standby nodes 19001 datastore standby nodes: noneaddons: enabled: dashboard # The Kubernetes dashboard dns # CoreDNS ha-cluster # Configure high availability on the current node ingress # Ingress controller for external access metallb # Loadbalancer for your Kubernetes cluster metrics-server # K8s Metrics Server For API access to service metrics storage # Storage class Allocates storage from host directory disabled: ambassador # Ambassador API Gateway and Ingress cilium # SDN Fast with full network policy fluentd # Elasticsearch-Fluentd-Kibana logging and monitoring gpu # Automatic enablement of Nvidia CUDA helm # Helm 2-the package manager for Kubernetes helm3 # Helm 3-Kubernetes package manager host-access # Allow Pods connecting to Host services smoothly istio # Core Istio service mesh services jaeger # Kubernetes Jaeger operator with its simple config keda # Kubernetes-based Event Driven Autoscaling knative # The Knative framework on Kubernetes. Kubeflow # Kubeflow for easy ML deployments linkerd # Linkerd isa service mesh for Kubernetes and other frameworks multus # Multus CNI enables attaching multiple network interfaces to pods portainer # Portainer UI for your Kubernetes cluster prometheus # Prometheus operator for monitoring and logging rbac # Role-Based Access Control for authorisation registry # Private image registry exposed on localhost:32000 traefik # traefik Ingress controller for external access
Prepare the images required by Microk8s:
MicroK8s's Kubernetes basic services are provided through multiple services of systemd (refer to the service name in the / etc/systemd/system directory). However, the current (1.20.2) pause service (3.0) is still on gcr.io, so it needs to be captured separately and deployed offline, otherwise various services will run normally, but kubelet service runtime errors will occur.
# for Microk8s 1.20.2MY_REGISTRY=registry.cn-hangzhou.aliyuncs.com/google_containersmicrok8s ctr images pull ${MY_REGISTRY} / pause:3.1microk8s ctr images tag ${MY_REGISTRY} / pause:3.1 k8s.gcr.io/pause:3.1microk8s ctr images pull docker.io/pollyduan/ingress-nginx-controller:v0.35.0microk8s ctr images tag docker.io/pollyduan/ingress-nginx-controller:v0.35.0 k8s.gcr.io/ingress-nginx/controller:v0.35. 0microk8s ctr images pull docker.io/faizanofc/metrics-server-amd64:v0.3.6microk8s ctr images tag docker.io/faizanofc/metrics-server-amd64:v0.3.6 k8s.gcr.io/metrics-server-amd64:v0.3.62 、 Install basic services
Install dns and local storage services:
Microk8s dns storage
Install gpu support:
Microk8s enable gpu3, install metallb service
Metallb provides a local LoadBalancer service that automatically allocates IP to the service, making it accessible to the outside world.
Create a LoadBalancer service for a private Kubernetes cluster
Microk8s enable metallb3.1 configuration
Next, we need to generate a Configmap file to set the URL range and protocol-related selection and configuration for Metallb. Here is a simple layer-2 configuration as an example:
ApiVersion: v1kind: ConfigMapmetadata: namespace: metallb-system name: configdata: config: | address-pools:-name: my-ip-space protocol: layer2 addresses:-10.211.55.240Comp28
Note: the IP address range here needs to correspond to the actual situation of the cluster.
After applying with the kubectl apply command, you can see the configuration update process by using microk8s.kubectl logs-f [metallb-controller-pod].
3.2 use testing
Create a Nginx service with a service type of LoadBalancer:
ApiVersion: apps/v1beta2kind: Deploymentmetadata: name: nginxspec: selector: matchLabels: app: nginx template: metadata: labels: app: nginxspec: containers:-name: nginx image: nginx:1 ports:-name: http containerPort: 80---apiVersion: v1kind: Servicemetadata: name: nginxspec: ports:-name: http port: 80 protocol: TCP targetPort: 80 selector: app: nginx type: LoadBalancer4, Install Dashboard
4.1 installation
Microk8s enable dashboard
4.2 configure Services
The configuration dashboard service can be accessed externally, which can be proxy, NodePort, LoadBalancer. I prefer to use NodePort, change ClusterType to NodePort, and then add a port number between 30000 and 32768 in the port section. As follows:
Microk8s.kubectl edit svc/dashboard-n kube-system
If there is a problem with editing, install vim first.
Sudo apt install vim
Then execute the above kubectl edit command, press I to enter edit mode, esc to exit, press: enter the command line, press wq to write and exit, force exit press Q!.
There are several ways to expose services to external access:
Nodeport, Loadbalancer and Ingress, https://my.oschina.net/u/2306127/blog/1647202
4.3 get service port
Microk8s.kubectl get svc-n kube-system
Enter the browser based on the external port of the dashboard shown above.
4.4 get token
Get the login token by using the following method:
Token=$ (microk8s kubectl-n kube-system get secret | grep default-token | cut-d ""-F1) microk8s kubectl-n kube-system describe secret $token
Then, choose to log in using token in dashboard, and copy the above token into the input box, and the dashboard interface appears.
5. Install KubeFlow
Execute:
Microk8s enable kubeflow
Finally failed, the installation rollback.
There is a problem installing KubeFlow, track the issue:
Https://github.com/ubuntu/microk8s/issues/958
Https://github.com/kubeflow/manifests/issues/1761
During installation, I used Jupyter to create the service and notebook, and found that the microk8s command could not be executed in notebook. Confirm that it is a problem with the path, as follows:
Bashexport PATH=$PATH:/snap/bin/microk8s status
Or add / snap/bin to the startup profile.
Thank you for reading! This is the end of this article on "how to install MicroK8s 1.20.2 based on Ubuntu 20.04". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it out for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.