[K8S] 01 - MiniKube, K3S or MicroKube

5分钟了解MiniKube

MinKube + Docker

 

【容器架构】Minikube vs.kind vs.k3s-我应该用哪一个?

下面您可以找到一个表,列出了每个工具的一些关键事实。

 minikubekindk3s
runtime VM container native
supported architectures AMD64 AMD64 AMD64, ARMv7, ARM64
supported container runtimes Docker,CRI-O,containerd,gvisor Docker Docker, containerd
startup time initial/following 5:19 / 3:15 2:48 / 1:06 0:15 / 0:15
memory requirements 2GB 8GB (Windows, MacOS) 512 MB
requires root? no no yes (rootless is experimental)
multi-cluster support yes yes no (can be achieved using containers)
multi-node support no yes yes
project page minikube kind k3s

原文:https://brennerm.github.io/posts/minikube-vs-kind-vs-k3s.html

Goto: Multi-Node K3s Cluster on NVIDIA Jetson Nano in 5 Minutes

 

 

是否应该选择 K3S

Ref: https://wener.me/story/k3s-one-week/

如果你犹豫使用 K3S 还是使用 K8S 请思考以下问题

    • 公司在平台投入多少 ?
    • 有多少专人维护 ?
      • K8S 建议至少 3-5 人
    • 节点资源性能如何 ?
      • K8S 建议至少 8 核 32G - 否则基础服务占用资源不能被平摊
    • 是否选择托管的 K8S ?
      • 不存在使用 K3S
    • 混合云、私有云、公有云 ?

或者用最简单的方式判断

    • 节点数 <=50 选择 K3S
      • 一人工作量
    • 50 < 节点数 <= 150 选择 K3S 或 K8S
    • 节点数量 > 150 选择 K8S
      • 有这样的规模,运维必然是一个团队,因此不存在 K8S 复杂的问题

 

 

 

B站:从0到1基础入门

开始

  • 下载并安装k3s

$ curl -sfL https://get.k3s.io | sh -
# 安装指定版本
$ curl -sfL https://get.k3s.io | INSTALL_K3S_VERSION=v1.0.1 sh -
  • 查看启动

$ tail -f /var/log/syslog
$ kubectl get all -n kube-system
  • 卸载

$ k3s-uninstall.sh

 

 

manifest 机制

containerd ---> host arch(arm64) ---> pull arch image(amd64)

 

添加集群

 

云边协同模式

 

 

 

MicroKube


Ref: microk8s 搭建

Ref: 使用 Microk8s 快速部署 kubernetes

安装

sudo snap install microk8s --classic

 

常用命令

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.start
Started.

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl cluster-info
Kubernetes control plane is running at https://127.0.0.1:16443
CoreDNS is running at https://127.0.0.1:16443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy

To further debug and diagnose cluster problems, use 'kubectl cluster-info dump'.

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get nodes
NAME             STATUS   ROLES    AGE    VERSION
ip-172-30-5-71   Ready    <none>   2d1h   v1.24.3-2+63243a96d1c393

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get pods
No resources found in default namespace.

 

启动 addons

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.status
microk8s is running
high-availability: no
datastore master nodes: 127.0.0.1:19001
datastore standby nodes: none
addons:
enabled:
dns # (core) CoreDNS
ha-cluster # (core) Configure high availability on the current node
disabled:
community # (core) The community addons repository
dashboard # (core) The Kubernetes dashboard
gpu # (core) Automatic enablement of Nvidia CUDA
helm # (core) Helm 2 - the package manager for Kubernetes
helm3 # (core) Helm 3 - Kubernetes package manager
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
mayastor # (core) OpenEBS MayaStor
metallb # (core) Loadbalancer for your Kubernetes cluster
metrics-server # (core) K8s Metrics Server for API access to service 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


$ sudo microk8s.enable dashboard

 

查看

Pods都READY嘛?

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get nodes

NAME STATUS ROLES AGE VERSION
ip-172-30-5-71 Ready <none> 2d2h v1.24.3-2+63243a96d1c393


ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get pods -n kube-system

NAME                                         READY   STATUS    RESTARTS       AGE
calico-node-7l29w                            1/1     Running   1 (137m ago)   2d2h
coredns-66bcf65bb8-gbb8c                     1/1     Running   0              26m
calico-kube-controllers-5d96b44665-zdtlz     1/1     Running   1 (137m ago)   2d2h
metrics-server-5f8f64cb86-tbwgm              1/1     Running   0              17m
kubernetes-dashboard-765646474b-jghcv        1/1     Running   0              16m
dashboard-metrics-scraper-6b6f796c8d-7lwk5   1/1     Running   0              16m

 

登录 Dashboard?

获取 dashboard 的 ClusterIP

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get svc -n kube-system
NAME TYPE CLUSTER
-IP EXTERNAL-IP PORT(S) AGE kube-dns ClusterIP 10.152.183.10 <none> 53/UDP,53/TCP,9153/TCP 49m metrics-server ClusterIP 10.152.183.126 <none> 443/TCP 37m kubernetes-dashboard ClusterIP 10.152.183.238 <none> 443/TCP 37m dashboard-metrics-scraper ClusterIP 10.152.183.128 <none> 8000/TCP 37m

 

Deployment of Nginx

ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl create deployment nginx --image=nginx
deployment.apps/nginx created
ubuntu@ip
-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get deployments NAME READY UP-TO-DATE AVAILABLE AGE nginx 1/1 1 1 13s ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ sudo microk8s.kubectl get pods -o wide NAME READY STATUS RESTARTS AGE IP NODE NOMINATED NODE READINESS GATES nginx-8f458dc5b-r9rtr 1/1 Running 0 27s 10.1.219.72 ip-172-30-5-71 <none> <none> ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ wget 10.1.219.72:80 --2022-09-11 08:34:25-- http://10.1.219.72/ Connecting to 10.1.219.72:80... connected. HTTP request sent, awaiting response... 200 OK Length: 615 [text/html] Saving to: ‘index.html’ index.html 100%[========================================================================>] 615 --.-KB/s in 0s 2022-09-11 08:34:25 (103 MB/s) - ‘index.html’ saved [615/615] ubuntu@ip-172-30-5-71:~/argo-workflows/argo-workflows-demo$ vim index.html

 

 

continue ...

posted @ 2021-11-16 09:31  郝壹贰叁  阅读(1665)  评论(0编辑  收藏  举报