https://github.com/k3s-io/k3s/discussions/5434#discussioncomment-2568382

例如修改端口和单节点最大pod数量(apiserver参数配置在master)

master

  • vim /etc/systemd/system/k3s.service
  • 如果是使用etcd作为存储, 配置文件在/etc/systemd/system/multi-user.target.wants/k3s.service
1
2
3
4
ExecStart=/usr/local/bin/k3s \
server \
'--kubelet-arg=max-pods=300' \
'--kube-apiserver-arg=service-node-port-range=30000-40000'
  • systemctl daemon-reload
  • systemctl restart k3s

node

  • vim /etc/systemd/system/k3s-agent.service
  • 如果是使用etcd作为存储, 配置文件在/etc/systemd/system/multi-user.target.wants/k3s-agent.service
1
2
3
ExecStart=/usr/local/bin/k3s \
agent \
'--kubelet-arg=max-pods=300'
  • systemctl daemon-reload
  • systemctl restart k3s-agent