Skip to content

🐛 join does not allow user-defined (aka custom) static pod manifests unless the user ignores a preflight check #2564

@dlipovetsky

Description

@dlipovetsky

What keywords did you search in kubeadm issues before filing this one?

DirAvailable

Is this a BUG REPORT or FEATURE REQUEST?

BUG REPORT

Versions

kubeadm version (use kubeadm version): v1.22.0

Environment:

  • Kubernetes version (use kubectl version):
  • Cloud provider or hardware configuration:
  • OS (e.g. from /etc/os-release):
  • Kernel (e.g. uname -a):
  • Others:

What happened?

I want to run a user-defined static pod on my machines, so I place it in /etc/kubernetes/manifests/foo.yaml on each machine.

[Update: To be clear, I mean a static pod manifest written to the file system by the user, not a static pod manifest written to the filesystem by kubeadm.]

On the first machine, I run kubeadm init, which succeeds. On other machines, I run kubeadm join, which fails a preflight check:

[preflight] Running pre-flight checks
error execution phase preflight: [preflight] Some fatal errors occurred:
    [ERROR DirAvailable--etc-kubernetes-manifests]: /etc/kubernetes/manifests is not empty

What you expected to happen?

I expect kubeadm to allow user-defined (aka custom) static pod manifests to be present in the manifests directory.

It is reasonable for kubeadm to have a preflight check for the presence of specific files in the manifests directory. For example, kubeadm derives the contents of, and writes the static pods for kube-apiserver, kube-controller-manager, kube-scheduler, and, unless external etcd is used, for etcd as well. If these static pods are already present, it is reasonable for a preflight check to fail.

How to reproduce it (as minimally and precisely as possible)?

  1. Create a cluster (in order to join a machine to it)
  2. On the machine, place a file in /etc/kubernetes/manifests
  3. On the machine, run kubeadm join

Anything else we need to know?

This affects the Cluster API Kubeadm Bootstrap Provider (CABPK), because it writes files to the machine (including /etc/kubernetes/manifests) before running kubeadm.

If I want to place a user-defined static pod manifest with CABPK, I always have to ignore this preflight check.

CABPK itself ignores the preflight check in one specific case.


I started a brief discussion prior to filing the issue: https://kubernetes.slack.com/archives/C8TSNPY4T/p1631126245196000

/cc @fabriziopandini @neolit123

Metadata

Metadata

Assignees

Labels

help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/bugCategorizes issue or PR as related to a bug.priority/backlogHigher priority than priority/awaiting-more-evidence.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions