我已经使用kubeadm成功安装了Kubernetes。我正在运行两个VirtualBox VM,一个用于K8s主服务器,另一个用于节点。
Kubernetes Master
sudo kubectl get nodes
NAME STATUS ROLES AGE VERSION
kubernetes-master Ready master 1h v1.10.2
kubernetes-node1 Ready <none> 1h v1.10.2
我可以正确地将两者都ssh到主(ssh 192.168.56.3
)和节点(ssh 192.168.56.4
)。
我想使用此部署文件在集群中部署nginx:
apiVersion: apps/v1 # for versions before 1.9.0 use apps/v1beta2
kind: Deployment
metadata:
name: nginx-deployment
spec:
selector:
matchLabels:
app: nginx
replicas: 2
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:latest
ports:
- containerPort: 80
我正在进入主节点,执行:sudo kubectl apply -f nginx-deployment.yml
。
我看到吊舱卡在PENDING上:
sudo kubectl get pods --all-namespaces
NAMESPACE NAME READY STATUS RESTARTS AGE
default nginx-deployment-64ff85b579-5vkdz 0/1 Pending 0 4m
default nginx-deployment-64ff85b579-w84lf 0/1 Pending 0 4m
这是其中一个的描述选项:
sudo kubectl describe pod nginx-deployment-64ff85b579-5vkdz
Name: nginx-deployment-64ff85b579-5vkdz
Namespace: default
Node: <none>
Labels: app=nginx
pod-template-hash=2099416135
Annotations: <none>
Status: Pending
IP:
Controlled By: ReplicaSet/nginx-deployment-64ff85b579
Containers:
nginx:
Image: nginx:latest
Port: 80/TCP
Host Port: 0/TCP
Environment: <none>
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-7glwn (ro)
Conditions:
Type Status
PodScheduled False
Volumes:
default-token-7glwn:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-7glwn
Optional: false
QoS Class: BestEffort
Node-Selectors: <none>
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Warning FailedScheduling 8s (x22 over 5m) default-scheduler 0/2 nodes are available: 1 node(s) had taints that the pod didn't tolerate, 1 node(s) were not ready, 1 node(s) were out of disk space.
可能是什么问题?
答案 0 :(得分:0)
嗯......出于某种原因,我的节点已关闭。我只需要重新启动kubelet服务,现在它可以工作:
systemctl restart kubelet.service