1

MicroK8s vs K3s vs minikube 本地k8s学习环境快速搭建

 1 year ago
source link: https://wsgzao.github.io/post/microk8s/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

有一段时间没好好整理k8s本地开发环境了,Kubernetes官方文档曾几何时已经支持中文语言切换且更新及时,感谢背后的开源社区协作者们。本文主要记录k8s本地开发环境快速搭建选型方案,毕竟现在公有云托管型Kubernetes越来越成熟,更重要的是怎么灵活运用云原生的理念提升基础架构管理水平。

2023年03月07日 - 初稿

阅读原文 - https://wsgzao.github.io/post/microk8s/


Kubernetes环境安装工具

k8s安装工具对比

Kubernetes官方维护的minikube
https://github.com/kubernetes/minikube

Rancher维护的k3s
https://github.com/rancher/k3s
https://github.com/k3s-io/k3s

Ubuntu母公司Canonical维护的 MicroK8s
https://github.com/ubuntu/micro

MicroK8s vs K3s vs minikube
https://microk8s.io/compare

202304141629908.png

本地学习环境

https://kubernetes.io/zh-cn/docs/tasks/tools/

  • kubectl
  • minikube
  • kubeadm

https://kind.sigs.k8s.io/docs/user/quick-start/

https://minikube.sigs.k8s.io/docs/start/

线上生产环境

https://kubernetes.io/zh-cn/docs/setup/production-environment/tools/

  • kubeadm
  • Kubespray

https://kubespray.io/

MicroK8s安装使用

https://microk8s.io/docs/install-macos

Install Homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
  1. Download the MicroK8s installer
    brew install ubuntu/microk8s/microk8s

  2. Run the installer or switch the version of Kubernetes

    microk8s install
    microk8s install --channel=1.26
    microk8s install --channel=1.24
  3. Check the status while Kubernetes starts
    microk8s status --wait-ready

microk8s status --wait-ready

microk8s is running
high-availability: no
datastore master nodes: 127.0.0.1:19001
datastore standby nodes: none
addons:
enabled:
ha-cluster # (core) Configure high availability on the current node
helm # (core) Helm - the package manager for Kubernetes
helm3 # (core) Helm 3 - the package manager for Kubernetes
disabled:
cert-manager # (core) Cloud native certificate management
community # (core) The community addons repository
dashboard # (core) The Kubernetes dashboard
dns # (core) CoreDNS
gpu # (core) Automatic enablement of Nvidia CUDA
host-access # (core) Allow Pods connecting to Host services smoothly
hostpath-storage # (core) Storage class; allocates storage from host directory
ingress # (core) Ingress controller for external access
kube-ovn # (core) An advanced network fabric for Kubernetes
mayastor # (core) OpenEBS MayaStor
metallb # (core) Loadbalancer for your Kubernetes cluster
metrics-server # (core) K8s Metrics Server for API access to service metrics
minio # (core) MinIO object storage
observability # (core) A lightweight observability stack for logs, traces and metrics
prometheus # (core) Prometheus operator for monitoring and logging
rbac # (core) Role-Based Access Control for authorisation
registry # (core) Private image registry exposed on localhost:32000
storage # (core) Alias to hostpath-storage add-on, deprecated
  1. Turn on the services you want
microk8s enable dashboard
microk8s enable dns
microk8s enable registry
microk8s enable community
microk8s enable istio

Addon istio was not found in any repository
To use the community maintained flavor enable the respective repository:

microk8s enable community

An error occurred when trying to execute 'sudo microk8s.enable istio' with 'multipass': returned exit code 1.

Try microk8s enable --help for a list of available services built in. The microk8s disable command turns off a service.

  1. Start using Kubernetes!
    microk8s kubectl get all --all-namespaces

  2. Access the Kubernetes dashboard
    microk8s dashboard-proxy

  3. Start and stop Kubernetes
    Kubernetes is a collection of system services that talk to each other all the time. If you don’t need them running in the background then you will save battery/resources by stopping them. the microk8s start and microk8s stop commands will do the work for you.

容器镜像加速和k8s实用工具推荐

左耳朵科学上网

https://github.com/haoel/haoel.github.io

Pull gcr.io’s image for hub.docker.com tools

https://github.com/OpsDocker/pullk8s

DaoCloud加速三剑客

镜像加速:https://github.com/DaoCloud/public-image-mirror

二进制文件加速:https://github.com/DaoCloud/public-binary-files-mirror

Helm 加速:https://github.com/DaoCloud/public-helm-charts-mirror

kubeconfig多配置文件切换工具推荐

https://wsgzao.github.io/post/kubeconfig/

使用krew安装node-shell轻松修改k8s宿主机root密码

https://wsgzao.github.io/post/krew/

K3d vs k3s vs Kind vs Microk8s vs Minikube

Minikube vs. kind vs. k3s - What should I use?

Minikube vs. kind vs. k3s vs k3d vs MicroK8s

轻量高可用的 K8s 集群搭建方案:MicroK8s

Microk8s安装与使用指南

比Minikube更快,使用Kind快速创建K8S学习环境


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK