Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

二摸 k3s: 探寻 #258

Open
Bpazy opened this issue Dec 20, 2022 · 2 comments
Open

二摸 k3s: 探寻 #258

Bpazy opened this issue Dec 20, 2022 · 2 comments
Labels

Comments

@Bpazy
Copy link
Owner

Bpazy commented Dec 20, 2022

安装、使用等

@Bpazy
Copy link
Owner Author

Bpazy commented Dec 20, 2022

安装 K3s

官方文档: https://docs.k3s.io/quick-start

Server 节点执行命令:curl -sfL https://get.k3s.io | sh -
Agent 节点执行命令:curl -sfL https://get.k3s.io | K3S_URL=https://myserver:6443 K3S_TOKEN=mynodetoken sh -

设置 K3S_URL 参数会使 K3s 以 Worker 模式运行。K3s Agent 将注册到在 URL 上监听的 K3s Server。K3S_TOKEN 使用的值存储在 Server 节点上的 /var/lib/rancher/k3s/server/node-token 中。

因为安装脚本会访问 github 等网站下载资源,所以如果有网络不通的问题,则需要转为使用离线安装,直接看官方文档即可: https://docs.k3s.io/installation/airgap

@Bpazy
Copy link
Owner Author

Bpazy commented Dec 20, 2022

K3s 网络

我这里使用的 K3s 版本为 v1.25.4+k3s1 (0dc63334), 自带了 Traefik Ingress Controller,并且会默认使用主机的 80, 443 端口,所以安装前先注意是否存在端口冲突。

如果想要修改默认端口号,可以编辑此文件: /var/lib/rancher/k3s/server/manifests/traefik-config.yaml

apiVersion: helm.cattle.io/v1
kind: HelmChartConfig
metadata:
  name: traefik
  namespace: kube-system
spec:
  valuesContent: |-
    ports:
      web:
        exposedPort: 6060
      websecure:
        exposedPort: 6443

其中 6060, 6443 就是 http, https 对应的端口号了,然后重启 k3s 服务或者 kubectl apply -f /var/lib/rancher/k3s/server/manifests/traefik-config.yaml

如果需要查看 Traefik Dashboard,则需要做端口转发:

kubectl -n kube-system port-forward $(kubectl -n kube-system get pods --selector "app.kubernetes.io/name=traefik" --output=name) 9000:9000

image

@Bpazy Bpazy changed the title 探寻 K3s 二摸 k3s: 探寻 Feb 29, 2024
@Bpazy Bpazy added the K3S label Dec 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant