首页 > 其他分享 >The easiest way to install Kubernetes on a Mac

The easiest way to install Kubernetes on a Mac

时间:2022-12-01 01:34:06浏览次数:73  
标签:Kubernetes talos talosctl cluster waiting install nodes easiest

The easiest way to install Kubernetes on a Mac

 

So you want to install Kubernetes on your Mac? The easiest way is to run Kubernetes on Docker, using Talos OS – Talos OS will install and configure Kubernetes on Docker for you. (Note that Docker Desktop does have support for Kubernetes built in, but it is an older version of Kubernetes, and limited to a single node cluster.) You can be up and exploring Kubernetes on Mac within 10 minutes, with all the advantages of an API managed, immutable, secure Kubernetes OS.

First, install Docker Desktop

Run Docker, give it the access it asks for, and you’ll see it chugging along in the menu bar. It will launch a wizard, which you can skip if you just want to run Talos and Kubernetes on your Mac.

A key component of Talos is talosctl, the CLI (Command Line Interface) which lets you interact with the OS running on your Kubernetes nodes (the same talosctl is used for Kubernetes on bare metal, VMWare, or cloud providers).

Download the latest release as shown below (or from Github here.)

curl -Lo /usr/local/bin/talosctl https://github.com/talos-systems/talos/releases/latest/download/talosctl-$(uname -s | tr "[:upper:]" "[:lower:]")-amd64
chmod +x /usr/local/bin/talosctl

Creating a local cluster is as simple as:

talosctl cluster create

This command will, by default, create a simple two node cluster, with one master node and one worker node. 

The creation of the kubernetes cluster takes a while to process (a few minutes on my Macbook Pro), and you may see some errors, as below, where the installation system expects services to be up, but they take longer on a docker based system than expected. Once the services do start, the installation proceeds correctly.

talosctl cluster create

validating CIDR and reserving IPs
generating PKI and tokens
downloading ghcr.io/talos-systems/talos:v0.11.3
creating network talos-default
creating master nodes
creating worker nodes
renamed talosconfig context "talos-default" -> "talos-default-1"
waiting for API
bootstrapping cluster
waiting for etcd to be healthy: 1 error occurred:
    * 10.5.0.3: service "etcd" not in expected state "Running": current state [Preparing] Running pre state
waiting for etcd to be healthy: OK
waiting for apid to be ready: OK
waiting for kubelet to be healthy: OK
waiting for all nodes to finish boot sequence: OK
waiting for all k8s nodes to report: OK
waiting for all k8s nodes to report ready: OK
waiting for all control plane components to be ready: OK
waiting for kube-proxy to report ready: OK
waiting for coredns to report ready: OK
waiting for all k8s nodes to report schedulable: OK

merging kubeconfig into "/Users/stevefrancis/.kube/config"
PROVISIONER       docker
NAME              talos-default
NETWORK NAME      talos-default
NETWORK CIDR      10.5.0.0/24
NETWORK GATEWAY   10.5.0.1
NETWORK MTU       1500

NODES:

NAME                      TYPE           IP         CPU    RAM      DISK
/talos-default-master-1   controlplane   10.5.0.2   2.00   2.1 GB   -
/talos-default-worker-1   join           10.5.0.3   2.00   2.1 GB   -

The cluster create command will create a kubeconfig for you.

Finally, we just need to specify which nodes you want to get information on using talosctl. Talosctl can operate on one or all the nodes in the cluster – this makes cluster wide commands much easier.

talosctl config nodes 10.5.0.2 10.5.0.3 

Note that these are the default addresses for a one master, one worker cluster. If you already have a variety of containers running, or created more master or worker nodes, you can verify the node addresses using docker inspect or talosctl cluster show, or from the output of the cluster create command.

You now have a complete (albeit simple) kubernetes cluster running on your mac. You can use talosctl to operate and examine the nodes. Some commands to try are:

talosctl containers
talosctl logs etcd
talosctl containers -k
talosctl logs -k kubelet
talosctl services

For further options with talosctl see the getting started guide and the talosctl documentation.

You can also explore Kubernetes on your Mac with Kubernetes commands:

kubectl  get nodes
NAME                   STATUS ROLES  AGE VERSION
talos-default-master-1 Ready  master 25h v1.19.0
talos-default-worker-1 Ready  none   25h v1.19.0

Also try:
kubectl  get pods -A

Creating more complex clusters

You can create a more complex Kubernetes cluster on your Mac by passing in different parameters. (Note that creating a larger cluster in Docker uses a lot of resources, and is not recommended unless you have a powerful machine.) e.g. to create a cluster with 3 masters and 1 worker, use:

talosctl cluster create   --wait-timeout 40m0s  --masters 3 --workers 1 --cpus 4;

(In order to install a new Talos OS based kubernetes cluster on the same Mac, you should talosctl cluster destroy the old cluster first, else you will run into naming conflicts.)

While you can runa multi-master cluster, there are some limitations to running on docker in a Mac – the networking is limited, so things like virtual IPs will not work correctly.

There are other ways to run Kubernetes on MacOS. But if you want to get Kubernetes on a Mac up and running quickly so you can start learning and testing – Docker and Talos OS is the way to do it. And if you want to see similar ease of use in bare metal kubernetes – check out Sidero!

标签:Kubernetes,talos,talosctl,cluster,waiting,install,nodes,easiest
From: https://www.cnblogs.com/yaoyangding/p/16940271.html

相关文章

  • Installing golang-1.18 on openEuler
    一、Installinggolang-1.18onopenEulerhttps://golang.google.cn1下载mkdir/opt/software&&cd/opt/softwarewgethttps://golang.google.cn/dl/go1.18.linux......
  • Installing PHP 7.2.10 on openEuler
    一、InstallingPHP7.2.10onopenEuler1安装php###dnfsearchphp###dnfinstallphp* X、OneStepSuccess1安装php-7.2.10日志查看代码[root@ecs-6568......
  • Pyinstaller 打包图片方法
    前戏​​Pyinstaller​​ 可以用来将python程序打包成独立可执行程序,让python程序能在没有装python环境的机器上运行。有时候用python写了一个小程序,但是共享给别人时,......
  • Kubernetes弃用Docker?其实不用慌
    近日,Kubernetes在1.20版本中的ChangeLog提到,将废弃Docker作为容器运行时。kubelet中的Docker支持功能现已弃用,并将在之后的版本中被删除。Kubelet之前使用的是一......
  • 博云:Kubernetes 近年影响最大版本发布,这几点值得关注
    近几年影响最大版本来袭2022年5月3日,Kubernetes1.24正式发布。这个版本的发布可以说是“姗姗来迟”和“万众瞩目”,因为此次发布对Kubernetes社区会带来深远影响。......
  • Kubernetes 1.25 发布!博云带你玩转新特性
    三个月转瞬即逝,Kubernetes如约发布了V1.25版本,新版本在诸多领域都有增强。Kubernetes1.25带来了40余项功能增强,其中13个功能成为稳定状态;10个是对于现有功能的改......
  • IIS报错:未能加载文件或程序集MySql.ConnectorInstaller, Version=8.0.8.0, Culture=ne
    删除machine.config中相关配置<siteMap><providers><addname="MySqlSiteMapProvider"type="MySql.Web.SiteMap.MySqlSiteMapProvider,MySql.ConnectorInstal......
  • 博云 Kubernetes 开源榜单贡献度进入全球前十
    近日,BoCloud博云成功进入Kubernetes开源榜单累计贡献度全球前十。​​在最新发布的 Kubernetes1.25版本中​​,博云贡献了数十个提交,主要集中在sig-cluster-lifecycle......
  • Kubernetes专栏 | 安装部署(一)
    --随着云原生概念的普及,许多企业的业务纷纷上云,为了追求可靠性,稳定性,和弹性伸缩,提升资源利用率等需求。Kubernetes这个谷歌开源的容器编排平台已日益流行,被大家熟知和......
  • docker install
    环境准备centos7Uninstalloldversionsyumremovedocker\docker-client\docker-client-latest\dock......