k3s-io / k3s

Lightweight Kubernetes
https://k3s.io
Apache License 2.0
27.94k stars 2.33k forks source link

[Release-1.28] - `k3s server` process shows up as `k3s agent` in process list #10621

Closed brandond closed 2 months ago

brandond commented 2 months ago

Backport fix for k3s server process shows up as k3s agent in process list

endawkins commented 2 months ago

Validated on branch release-1.28 with commit 815efbf / version 1.28

Environment Details

Infrastructure

Node(s) CPU architecture, OS, and Version:

Linux ip-172-31-15-66 5.15.0-1019-aws #23-Ubuntu SMP Wed Aug 17 18:33:13 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
PRETTY_NAME="Ubuntu 22.04.1 LTS"
NAME="Ubuntu"
VERSION_ID="22.04"
VERSION="22.04.1 LTS (Jammy Jellyfish)"
VERSION_CODENAME=jammy
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=jammy

Cluster Configuration:

N/A [Any setup suffices as long as there is one server]

Config.yaml:

write-kubeconfig-mode: "0644"
tls-san:
  - fake.fqdn.value
node-name: [REDACTED]
protect-kernel-defaults: true
selinux: true
node-external-ip: [REDACTED]
node-ip: [REDACTED]
cluster-init: true
secrets-encryption: true
kube-apiserver-arg:
  - 'audit-log-path=/var/lib/rancher/k3s/server/logs/audit.log'
  - 'audit-policy-file=/var/lib/rancher/k3s/server/audit.yaml'
  - 'audit-log-maxage=30'
  - 'audit-log-maxbackup=10'
  - 'audit-log-maxsize=100'
  - 'request-timeout=300s'
  - 'service-account-lookup=true'
  - 'enable-admission-plugins=NodeRestriction,PodSecurity,NamespaceLifecycle,ServiceAccount'
  - 'admission-control-config-file=/var/lib/rancher/k3s/server/cluster-level-pss.yaml'
kube-controller-manager-arg:
  - 'terminated-pod-gc-threshold=10'
  - 'use-service-account-credentials=true'
kubelet-arg:
  - 'streaming-connection-idle-timeout=5m'
  - 'make-iptables-util-chains=true'

Additional files

N/A

Testing Steps

  1. Copy config.yaml
    $ sudo mkdir -p /etc/rancher/k3s && sudo cp config.yaml /etc/rancher/k3s
  2. Install k3s
  3. kubectl get nodes,pods -A -o wide
  4. ps auxfww | grep bin/k3s

Replication Results:

kubectl get node -o wide
NAME                                         STATUS   ROLES                       AGE     VERSION         INTERNAL-IP    EXTERNAL-IP   OS-IMAGE             KERNEL-VERSION    CONTAINER-RUNTIME
ip-172-31-15-87.us-east-2.compute.internal   Ready    <none>                      4h13m   v1.28.12+k3s1   172.31.15.87   [REDACTED]    Ubuntu 22.04.1 LTS   5.15.0-1019-aws   containerd://1.7.17-k3s1.28
ip-172-31-8-85.us-east-2.compute.internal    Ready    control-plane,etcd,master   4h15m   v1.28.12+k3s1   172.31.8.85    [REDACTED]    Ubuntu 22.04.1 LTS   5.15.0-1019-aws   containerd://1.7.17-k3s1.28

ps auxfww | grep bin/k3s
ubuntu     19919  0.0  0.0   7004  2076 pts/1    S+   03:13   0:00              \_ grep --color=auto bin/k3s
root        7789 10.7 13.6 16481808 542832 ?     Ssl  Aug09  29:25 /usr/local/bin/k3s agent

Validation Results:

kubectl get nodes,pods -A -o wide
NAME                                              STATUS   ROLES                       AGE    VERSION                 INTERNAL-IP    EXTERNAL-IP     OS-IMAGE             KERNEL-VERSION    CONTAINER-RUNTIME
node/ip-172-31-10-25.us-east-2.compute.internal   Ready    <none>                      9m9s   v1.28.12+k3s-815efbfc   172.31.10.25   [REDACTED]      Ubuntu 22.04.1 LTS   5.15.0-1019-aws   containerd://1.7.20-k3s2.28
node/ip-172-31-15-66.us-east-2.compute.internal   Ready    control-plane,etcd,master   11m    v1.28.12+k3s-815efbfc   172.31.15.66   [REDACTED]      Ubuntu 22.04.1 LTS   5.15.0-1019-aws   containerd://1.7.20-k3s2.28

ps auxfww | grep bin/k3s
ubuntu     10855  0.0  0.0   7004  2076 pts/0    S+   03:31   0:00              \_ grep --color=auto bin/k3s
root        7752 18.8 13.1 16412476 522648 ?     Ssl  03:25   1:06 /usr/local/bin/k3s server

Additional context / logs:

N/A