kubernetes/kubernetes · error
user is not running as root
Error message
user is not running as root
What it means
Returned by IsPrivilegedUserCheck.Check (unix build) when os.Getuid() != 0. kubeadm must run as root on Linux to write /etc/kubernetes, manipulate certs, systemd, and iptables. This is a hard preflight error.
Source
Thrown at cmd/kubeadm/app/preflight/checks_unix.go:30
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package preflight
import (
"os"
"k8s.io/kubernetes/cmd/kubeadm/app/util/errors"
)
// Check validates if an user has elevated (root) privileges.
func (ipuc IsPrivilegedUserCheck) Check() (warnings, errorList []error) {
if os.Getuid() != 0 {
return nil, []error{errors.New("user is not running as root")}
}
return nil, nil
}
View on GitHub (pinned to b882c60b40)
Solutions
- Run kubeadm with root privileges: prefix with sudo or run as the root user.
- If using sudo, ensure the full command and environment are elevated (sudo kubeadm ...).
- Avoid su-to-non-root wrappers that reset uid.
Example fix
# before kubeadm init ... # error: user is not running as root # after sudo kubeadm init ...
Defensive patterns
Strategy: validation
Validate before calling
if os.Getuid() != 0 {
return errors.New("kubeadm must run as root; re-run with sudo")
} Prevention
- Invoke kubeadm via sudo or as root.
- In automation, ensure the runner uid is 0.
- Avoid privilege-dropping wrappers around the kubeadm process.
When it happens
Trigger: Running 'kubeadm init/join/reset/upgrade' on a non-Linux-Windows platform (the !windows build) as a non-root user (uid != 0).
Common situations: Running kubeadm without sudo. SSH'ing as a non-root user and invoking kubeadm directly. Containers/contexts that drop privileges.
Related errors
- the kubeadm process must be run by a user with elevated priv
- You must update your container runtime to a version that sup
- %s not found in system path
- swap is supported for cgroup v2 only. The kubelet must be pr
- preflight checks failed
AI-assisted analysis of kubernetes/kubernetes@b882c60b40 (2026-08-07).
Data as JSON: /api/errors/c10633e777da0047.
Report an issue: GitHub.