How to enable a k0s host to run applications?

The k0s host installed using the following command is in a pending state during application deployment. How to install it so that this k0s host can run the application normally?

k0s install controller --enable-worker

[root@localhost ~]# k0s kubectl get node
NAME STATUS ROLES AGE VERSION
localhost.localdomain Ready control-plane 2d4h v1.29.2+k0s
[root@localhost ~]# k0s kubectl get pod -A
NAMESPACE NAME READY STATUS RESTARTS AGE
default nginxtest-77b9fd8f77-cdzgj 0/1 Pending 0 28h
kube-system coredns-6cd46fb86c-t9mq7 1/1 Running 0 2d4h
kube-system konnectivity-agent-g9w9g 1/1 Running 0 28h
kube-system kube-proxy-cv5dh 1/1 Running 0 2d4h
kube-system kube-router-jv57d 1/1 Running 0 2d4h
kube-system metrics-server-7556957bb7-gqxjh 1/1 Running 0 2d4h
[root@localhost ~]# k0s kubectl describe pod nginxtest-77b9fd8f77-cdzgj -n default
Name: nginxtest-77b9fd8f77-cdzgj
Namespace: default
Priority: 0
Service Account: default
Node:
Labels: pod-template-hash=77b9fd8f77
workload.user.cattle.io/workloadselector=deployment-default-nginxtest
Annotations: field.cattle.io/ports:
[[{“containerPort”:80,“dnsName”:“nginxtest-nodeport”,“hostPort”:0,“kind”:“NodePort”,“name”:“nginx-port”,“protocol”:“TCP”,“sourcePort”:3270…
Status: Pending
IP:
IPs:
Controlled By: ReplicaSet/nginxtest-77b9fd8f77
Containers:
nginxtest:
Image: docker.io/rancher/library-nginx:1.19.2-alpine
Port: 80/TCP
Host Port: 0/TCP
Environment:
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-w4ph4 (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
kube-api-access-w4ph4:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional:
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors:
Tolerations: node.kubernetes.io/not-ready:NoExecute op=Exists for 300s
node.kubernetes.io/unreachable:NoExecute op=Exists for 300s
Events:
Type Reason Age From Message


Warning FailedScheduling 33m (x300 over 25h) default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/master: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.
[root@localhost ~]#

Hi @hzpurewater,
The worker is installed and deployed. You can see that because some pods are running:

kube-system coredns-6cd46fb86c-t9mq7 1/1 Running 0 2d4h
kube-system konnectivity-agent-g9w9g 1/1 Running 0 28h

The events say:

Warning FailedScheduling 33m (x300 over 25h) default-scheduler 0/1 nodes are available: 1 node(s) had untolerated taint {node-role.kubernetes.io/master: }. preemption: 0/1 nodes are available: 1 Preemption is not helpful for scheduling.

This means your workload is not running because the node has a taint node-role.kubernetes.io/master . You’ll need to add a Toleration to your application for it to work.

Based on the output this seems to be a deployment, so you’ll need to patch your deployment so that .spec.template.spec contains:

      tolerations:
      - operator: "Exists"

Probably you’ll need to fix the identation.