Repository navigation
Description
Version
$ openshift-install version
openshift-install v4.1.0-201905212232-dirty
built from commit 71d8978039726046929729ad15302973e3da18ce
release image quay.io/openshift-release-dev/ocp-release@sha256:b8307ac0f3ec4ac86c3f3b52846425205022da52c16f56ec31cbe428501001d6RHCOS
rpm-ostree status
State: idle
AutomaticUpdates: disabled
Deployments:
● pivot://quay.io/openshift-release-dev/ocp-v4.0-art-dev@sha256:53389c9b4a00d7afebb98f7bd9d20348deb1d77ca4baf194f0ae1b582b7e965b
CustomOrigin: Provisioned from oscontainer
Version: 410.8.20190520.0 (2019-05-20T22:55:04Z)
Platform (aws|libvirt|openstack):
vmware
What happened?
Deployed an UPI VMware cluster and then started to add a new node. The VM booted, the igniton kicked in and lay down the RHCOS, including setting the static IP and the hostname however the node it never joined the K8s cluster, oc get nodes didn't show the new node
What you expected to happen?
i expected the new node to show up in the oc get nodes
How to reproduce it (as minimally and precisely as possible)?
- create a cluster
- scale up a node using a custom
dani-k8s-node-2.ignfile where the below files were added such that we can set static IP and hostname
cat > ${NGINX_DIRECTORY}/${HOST}-ens192 << EOF
DEVICE=ens192
BOOTPROTO=none
ONBOOT=yes
NETMASK=${NETMASK}
IPADDR=${IP}
GATEWAY=${GATEWAY}
PEERDNS=no
DNS1=${DNS1}
DNS2=${DNS2}
DOMAIN=${DOMAIN_NAME}
IPV6INIT=no
EOF
ENS192=$(cat ${NGINX_DIRECTORY}/${HOST}-ens192 | base64 -w0)
rm ${NGINX_DIRECTORY}/${HOST}-ens192
cat > ${NGINX_DIRECTORY}/${HOST}-ifcfg-ens192.json << EOF
{
"append" : false,
"mode" : 420,
"filesystem" : "root",
"path" : "/etc/sysconfig/network-scripts/ifcfg-ens192",
"contents" : {
"source" : "data:text/plain;charset=utf-8;base64,${ENS192}",
"verification" : {}
},
"user" : {
"name" : "root"
},
"group": {
"name": "root"
}
}
EOF
&
cat > ${NGINX_DIRECTORY}/${HOST}-hostname << EOF
${HOST}.${DOMAIN_NAME}
EOF
HN=$(cat ${NGINX_DIRECTORY}/${HOST}-hostname | base64 -w0)
rm ${NGINX_DIRECTORY}/${HOST}-hostname
cat > ${NGINX_DIRECTORY}/${HOST}-hostname.json << EOF
{
"append" : false,
"mode" : 420,
"filesystem" : "root",
"path" : "/etc/hostname",
"contents" : {
"source" : "data:text/plain;charset=utf-8;base64,${HN}",
"verification" : {}
},
"user" : {
"name" : "root"
},
"group": {
"name": "root"
}
}
EOF
Note that a dummy ignition file
dani-k8s-node-2-ignition-starter.ign
{
"ignition": {
"config": {
"append": [
{
"source": "http://10.85.174.63/repo/dani-k8s-node-2.ign",
"verification": {}
}
]
},
"timeouts": {},
"version": "2.2.0"
},
"networkd": {},
"passwd": {},
"storage": {},
"systemd": {}
}
was passed which then redirected to the custom dani-k8s-node-2.ign file which had injected the above snippets. That triggered a reboot between the ignition apply steps
- observe if the node join the cluster, if not then check if
kubelet.serviceis up and running.
Note - i guess your terraform UPI's vsphere example should allow you to reproduce the issue, i haven't tried using your code
Anything else we need to know?
On closer inspection while ssh'ed onto the node i found the following
kubectl.servicenot active and disabled
[root@dani-k8s-node-2 ~]# systemctl list-unit-files | grep disabled | egrep "mcd|kubelet|rpm-ostree|podman|crio"
crio-shutdown.service disabled
io.podman.service disabled
kubelet.service disabled
mcd-write-pivot-reboot.service disabled
io.podman.socket disabled
rpm-ostreed-automatic.timer disabled
and
[root@dani-k8s-node-2 ~]# systemctl status kubelet
● kubelet.service - Kubernetes Kubelet
Loaded: loaded (/etc/systemd/system/kubelet.service; disabled; vendor preset: enabled)
Active: inactive (dead)
- although the systemd file looks okay, there is no symlink created which explains why the service is not running and enabled
[root@dani-k8s-node-2 ~]# cat /etc/systemd/system/kubelet.service
[Unit]
Description=Kubernetes Kubelet
Wants=rpc-statd.service
[Service]
Type=notify
ExecStartPre=/bin/mkdir --parents /etc/kubernetes/manifests
ExecStartPre=/bin/rm -f /var/lib/kubelet/cpu_manager_state
EnvironmentFile=/etc/os-release
EnvironmentFile=-/etc/kubernetes/kubelet-workaround
EnvironmentFile=-/etc/kubernetes/kubelet-env
ExecStart=/usr/bin/hyperkube \
kubelet \
--config=/etc/kubernetes/kubelet.conf \
--bootstrap-kubeconfig=/etc/kubernetes/kubeconfig \
--kubeconfig=/var/lib/kubelet/kubeconfig \
--container-runtime=remote \
--container-runtime-endpoint=/var/run/crio/crio.sock \
--allow-privileged \
--node-labels=node-role.kubernetes.io/worker,node.openshift.io/os_version=${VERSION_ID},node.openshift.io/os_id=${ID} \
--minimum-container-ttl-duration=6m0s \
--volume-plugin-dir=/etc/kubernetes/kubelet-plugins/volume/exec \
--client-ca-file=/etc/kubernetes/ca.crt \
--cloud-provider=vsphere \
\
--anonymous-auth=false \
--v=3 \
Restart=always
RestartSec=10
[Install]
WantedBy=multi-user.target
but no symlink present
[root@dani-k8s-node-2 ~]# ll /etc/systemd/system/multi-user.target.wants/
total 0
lrwxrwxrwx. 1 root root 39 May 20 23:06 chronyd.service -> /usr/lib/systemd/system/chronyd.service
lrwxrwxrwx. 1 root root 70 May 20 23:06 console-login-helper-messages-issuegen.service -> /usr/lib/systemd/system/console-login-helper-messages-issuegen.service
lrwxrwxrwx. 1 root root 47 May 20 23:06 coreos-growpart.service -> /usr/lib/systemd/system/coreos-growpart.service
lrwxrwxrwx. 1 root root 69 May 20 23:06 coreos-regenerate-iscsi-initiatorname.service -> /usr/lib/systemd/system/coreos-regenerate-iscsi-initiatorname.service
lrwxrwxrwx. 1 root root 67 May 20 23:06 coreos-root-bash-profile-workaround.service -> /usr/lib/systemd/system/coreos-root-bash-profile-workaround.service
lrwxrwxrwx. 1 root root 51 May 20 23:06 coreos-useradd-core.service -> /usr/lib/systemd/system/coreos-useradd-core.service
lrwxrwxrwx. 1 root root 36 May 20 23:06 crio.service -> /usr/lib/systemd/system/crio.service
lrwxrwxrwx. 1 root root 59 May 20 23:06 ignition-firstboot-complete.service -> /usr/lib/systemd/system/ignition-firstboot-complete.service
lrwxrwxrwx. 1 root root 42 May 20 23:06 irqbalance.service -> /usr/lib/systemd/system/irqbalance.service
lrwxrwxrwx. 1 root root 41 May 20 23:06 mdmonitor.service -> /usr/lib/systemd/system/mdmonitor.service
lrwxrwxrwx. 1 root root 46 May 20 23:06 NetworkManager.service -> /usr/lib/systemd/system/NetworkManager.service
lrwxrwxrwx. 1 root root 51 Jun 17 17:24 ostree-finalize-staged.path -> /usr/lib/systemd/system/ostree-finalize-staged.path
lrwxrwxrwx. 1 root root 37 May 20 23:06 pivot.service -> /usr/lib/systemd/system/pivot.service
lrwxrwxrwx. 1 root root 48 May 20 23:06 remote-cryptsetup.target -> /usr/lib/systemd/system/remote-cryptsetup.target
lrwxrwxrwx. 1 root root 40 May 20 23:06 remote-fs.target -> /usr/lib/systemd/system/remote-fs.target
lrwxrwxrwx. 1 root root 53 May 20 23:06 rpm-ostree-bootstatus.service -> /usr/lib/systemd/system/rpm-ostree-bootstatus.service
lrwxrwxrwx. 1 root root 36 May 20 23:06 sshd.service -> /usr/lib/systemd/system/sshd.service
lrwxrwxrwx. 1 root root 40 May 20 23:06 vmtoolsd.service -> /usr/lib/systemd/system/vmtoolsd.service
Running systemctl start kubelet.service it does kick the whole process and at the end the node joins the cluster.
References
- enter text here.
Activity
DanyC97 commentedon Jun 24, 2019
/cc @cgwalters in case you have some thoughts from RHCOS/ MCO side.
abhinavdahiya commentedon Jun 24, 2019
are you sure you approved the CSR for your machine https://docs.openshift.com/container-platform/4.1/installing/installing_vsphere/installing-vsphere.html#installation-approve-csrs_installing-vsphere
abhinavdahiya commentedon Jun 24, 2019
what do you mean by rebooted between ignition apply steps.. ignition doesn't require reboot.
DanyC97 commentedon Jun 25, 2019
@abhinavdahiya thank you for taking the time to respond, much appreciated !
i never needed to approve any CSR, what i saw on previous deployments (for control and compute nodes) was that the CSRs were auto approved.
I'm not sure if there are two paths (if there are please help me understand how it works) here in v4 w.r.t approving the CSRs however all i can say is that looking in the cluster i have running (where the above node didn't join the cluster) i see
which is coming from cluster-machine-approver and i can see in the pod's log traces like
Saying that i am not sure if this is part of the machine-api-operator as i haven't worked out how to trace backwards a deployment -> operator (any hints much appreciated ;) ) ..but i guess it is ..
Update
see attached the whole
machine-approver-7cd7f97455-g9x5qpod's log in case you might find s'thing ...pod-machine-approver-7cd7f97455-g9x5q.log
DanyC97 commentedon Jun 25, 2019
please see the dani-k8s-node-2_journalctl.log attached. I've added some bookmarks
### dani ###so you can see why i assumed the above sequence triggered the reboot.DanyC97 commentedon Jun 26, 2019
@abhinavdahiya any thoughts? or maybe @staebler might be able to chime in?
any addition info please let me know, i'm keeping the lab env up in case more info is needed, hopefully will help you out
DanyC97 commentedon Jun 27, 2019
@cgwalters @abhinavdahiya can anyone of you please help understand the design/ behavior of
kubelet servicenot started on worker nodesrphillips commentedon Jun 27, 2019
@DanyC97 the controller-manager within the openshift-controller-manager namespaces actually does the issuing of the certificate. The logs there might help.
staebler commentedon Jun 27, 2019
@DanyC97 The cluster-machine-approver will only approve machines that are added via a
machineresource. The vSphere platform does not usemachineresources yet. So, as a user, you must manually approve CSR requests for new nodes. As a convenience, the bootstrap machine will auto-approve CSRs requests for nodes while it is running. However, that should not be relied upon.DanyC97 commentedon Jun 28, 2019
oh so there are 2 paths, many many thanks for sharing this info @staebler !
right, so i'll try a test of switching off the bootstrap and see if the CSRs requests are left in pending state, that should confirm.
DanyC97 commentedon Jun 28, 2019
i'll check @rphillips , thanks for the info!
i'll be curious to understand the whole flow as things don't add up (yet) in my head:
DanyC97 commentedon Jun 29, 2019
sadly @rphillips the only output i see in the pods running in
openshift-controller-managerns isso not much related to CSRs
DanyC97 commentedon Jul 1, 2019
@staebler you were spot on Sir !
i've turned off bootstrap node and it behaves as per the docs
which imo this is a docs bug.
And for folks who need to know if bootstrap node did approve anything
journalctl |grep approve-csr |grep -v "No resources found"will do the jobDanyC97 commentedon Jul 1, 2019
@abhinavdahiya if you can point me in the right direction, i'd be happy to keep digging.
staebler commentedon Jul 1, 2019
@DanyC97 Can you be more specific about how you feel that the docs are deficient?
The following is an excerpt from the docs. It implies to me that the CSRs may be approved automatically or may need to be approved manually. It is the responsibility of the user to verify that the CSRs are approved--whether automatically or manually.
DanyC97 commentedon Jul 1, 2019
sure, sorry i wasn't clear enough.
Indeed you are, the text implies that however You must confirm that these CSRs are approved -> if you trying to double check if they were approved, you won't be able to do so w/o a bit more info becasue:
oc get csr=> will show no output (e.gApproved, Issued), they've been already dealt by bootstrap node. Maybe the assumption here is that: if you see noPendingcerts then everything worked okay.Imo having a section - a small note and/ or paragraph to mention what you taught me here is miles better, hence me saying a bug
Also in the docs it says on step 1
Confirm that the cluster recognizes the machines:
but you can't confirm that since there are no nodes in
NotReadystate, they will appear if kubelet service is running .. however if you are unlucky like me then the docs won't help much.Maybe is a section for troubleshooting, either way i think a clue can be added to help folks.
Update
sorry if i was too strong on the docs claiming is a bug, is maybe an enhancement
cgwalters commentedon Jul 1, 2019
Ignition should have enabled
kubelet.service, it's part of the Ignition generated by the MCO.DanyC97 commentedon Jul 1, 2019
right after keep spinning new nodes, i found out that the dependent service
hasn't started ...hmmm
DanyC97 commentedon Jul 2, 2019
and the dependencies for
rpc-statdiswhere
rpcbind.serviceis not running.And the output of the
network-online.targetis up and happyDanyC97 commentedon Jul 8, 2019
updating in case someone else bumps into this issue.
A) the initial issue was around the fact that nodes we failing to join the cluster because the
kubelet.serviceAfter a lot of digging (few dead ends and lots of bunny hop) it turned out the problem was caused by my DNS setup, in particular my nodes fqdn was not withing the subdomain where the
apiandapi-intwereE.g
NOK
dani-k8s-node-1.dani.localapi-int.dev-okd4.dani.localOK
dani-k8s-node-1.dev-okd4.dani.localapi-int.dev-okd4.dani.localB) the second issue (which was more like a question for my own knowledge) was around the fact that the
CSRswere approved. With @staebler 's help i've understood there are 2 paths:bootstrapnode is still up, the CSRs are auto aprovedcgwalters commentedon Jul 8, 2019
Probably what we should have done is only have the bootstrap approve CSRs for masters only or so...that's all we actually need for installs, and having it do workers too adds confusion.
DanyC97 commentedon Jul 9, 2019
@cgwalters thinking loud i think is okay to have both use-cases, especially when you build a 100 nodes cluster, you don't need a human to accept the CSRs nor keep running/ watching using your favor tool/ script for pending CSRs.
A note in the docs imo will be exactly what folks need:
staebler commentedon Jul 9, 2019
I do not think that we want to advise leaving the bootstrap node running any longer than necessary.
fdammeke commentedon Feb 17, 2021
@DanyC97 could you elaborate your findings regarding DNS a bit more? I'm bumping in the same issue as you describe when adding a node to an existing cluster. The initial provisioned cluster doesn't have fqdn hostnames within the api / api-int endpoint url either, so I'm curious how this is related?
What comes to my attention is the fact there are no symbolic links for kubelet or machine-config-daemon in /etc/systemd/system/multi-user.target.wants/ on the extra worker nodes, but they are present on the initial installation worker nodes. Any thoughts?