树莓派安装k3s

raspberrypi ubuntu install k3s

requirements:

https://docs.k3s.io/advanced#additional-preparation-for-raspberry-pi-os

install:
curl -sfL https://rancher-mirror.oss-cn-beijing.aliyuncs.com/k3s/k3s-install.sh | K3S_KUBECONFIG_MODE="644" INSTALL_K3S_MIRROR=cn sh -
verify installation:
systemctl status k3s.service

example:
pi@raspberrypi:~ $ systemctl status k3s.service
● k3s.service - Lightweight Kubernetes
     Loaded: loaded (/etc/systemd/system/k3s.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2022-10-09 19:45:20 CST; 42s ago
       Docs: https://k3s.io
    Process: 998 ExecStartPre=/bin/sh -xc ! /usr/bin/systemctl is-enabled --quiet nm-cloud-setup.service (code=exited, status=0/SUCCESS)
    Process: 1006 ExecStartPre=/sbin/modprobe br_netfilter (code=exited, status=0/SUCCESS)
    Process: 1008 ExecStartPre=/sbin/modprobe overlay (code=exited, status=0/SUCCESS)
   Main PID: 1009 (k3s-server)
      Tasks: 107
     Memory: 471.4M
        CPU: 49.051s
     CGroup: /system.slice/k3s.service
             ├─1009 /usr/local/bin/k3s server
             ├─1101 containerd -c /var/lib/rancher/k3s/agent/etc/containerd/config.toml -a /run/k3s/containerd/containerd.sock --state /run/k3s/containerd --root /var/lib/rancher/k3s/agent/containerd
             ├─2229 /var/lib/rancher/k3s/data/e7bc2e5951d7fc2b8da4bc5419f9c3241ea6903efadda7515e51af80a72ed5ad/bin/containerd-shim-runc-v2 -namespace k8s.io -id a6b976d6ecb15ab0310c8914c0965504a382b4e3a91cc637bcc035650e47e86e -address /run/>
             ├─2230 /var/lib/rancher/k3s/data/e7bc2e5951d7fc2b8da4bc5419f9c3241ea6903efadda7515e51af80a72ed5ad/bin/containerd-shim-runc-v2 -namespace k8s.io -id eec9f26519045ce7500b4231ddf7aa4f3401fa89367a27e507ee3f1532083575 -address /run/>
             ├─2231 /var/lib/rancher/k3s/data/e7bc2e5951d7fc2b8da4bc5419f9c3241ea6903efadda7515e51af80a72ed5ad/bin/containerd-shim-runc-v2 -namespace k8s.io -id 4908466ae648d544ab4cd4b5663008b46e42b73a8baee48d107b8ee33e393687 -address /run/>
             ├─2232 /var/lib/rancher/k3s/data/e7bc2e5951d7fc2b8da4bc5419f9c3241ea6903efadda7515e51af80a72ed5ad/bin/containerd-shim-runc-v2 -namespace k8s.io -id 7b3b5fccefb38244797b6fc5527c97431dc527e23075152e049133dc06655827 -address /run/>
             └─2240 /var/lib/rancher/k3s/data/e7bc2e5951d7fc2b8da4bc5419f9c3241ea6903efadda7515e51af80a72ed5ad/bin/containerd-shim-runc-v2 -namespace k8s.io -id a331f18d50ddfd06806c007405173f4e473a17614805b5ff8bab2e5fdc086b56 -address /run/>

10月 09 19:45:46 raspberrypi k3s[1009]: I1009 19:45:46.271590    1009 vxlan_network.go:61] watching for new subnet leases
10月 09 19:45:46 raspberrypi k3s[1009]: I1009 19:45:46.348412    1009 iptables.go:177] bootstrap done
10月 09 19:45:46 raspberrypi k3s[1009]: I1009 19:45:46.359307    1009 iptables.go:177] bootstrap done
10月 09 19:45:46 raspberrypi k3s[1009]: W1009 19:45:46.439661    1009 handler_proxy.go:105] no RequestInfo found in the context
10月 09 19:45:46 raspberrypi k3s[1009]: E1009 19:45:46.439807    1009 controller.go:113] loading OpenAPI spec for "v1beta1.metrics.k8s.io" failed with: Error, could not get list of group versions for APIService
10月 09 19:45:46 raspberrypi k3s[1009]: I1009 19:45:46.439851    1009 controller.go:126] OpenAPI AggregationController: action for item v1beta1.metrics.k8s.io: Rate Limited Requeue.
10月 09 19:45:46 raspberrypi k3s[1009]: W1009 19:45:46.440016    1009 handler_proxy.go:105] no RequestInfo found in the context
10月 09 19:45:46 raspberrypi k3s[1009]: E1009 19:45:46.440181    1009 controller.go:116] loading OpenAPI spec for "v1beta1.metrics.k8s.io" failed with: failed to retrieve openAPI spec, http error: ResponseCode: 503, Body: service unavailable
10月 09 19:45:46 raspberrypi k3s[1009]: , Header: map[Content-Type:[text/plain; charset=utf-8] X-Content-Type-Options:[nosniff]]
10月 09 19:45:46 raspberrypi k3s[1009]: I1009 19:45:46.441377    1009 controller.go:129] OpenAPI AggregationController: action for item v1beta1.metrics.k8s.io: Rate Limited Requeue.

常见错误

1.不能看日志(kubectl logs -f podName)

Error from server: Get "https://192.168.137.107:10250/containerLogs/default/mysql-679d847c79-9rzr6/mysql?follow=true": EOF

解决办法:
关闭防火墙
or
https://zhuanlan.zhihu.com/p/545327043
可能需要配置containered代理之类的
or
如果还是报看不了日志的错误,考虑下重装k3s

uninstall:
/usr/local/bin/k3s-uninstall.sh

你可能感兴趣的:(k3s,kubernetes,运维,linux)