我是 Kubernetes 的新手,我正在努力解决一些错误。我想在我的本地系统(mac(上创建Kubernetes Cluster。
我的部署.yaml --
apiVersion: apps/v1
kind: Deployment
metadata:
name: sv-premier
spec:
selector:
matchLabels:
app: sv-premier
template:
metadata:
labels:
app: sv-premier
spec:
volumes:
- name: google-cloud-key
secret:
secretName: gcp-key
containers:
- name: sv-premier
image: gcr.io/proto/premiercore1:latest
imagePullPolicy: Always
command: ["/bin/sh"]
args: ["-c", "while true; do echo Done Deploying sv-premier; sleep 3600;done"]
volumeMounts:
- name: google-cloud-key
mountPath: /var/secrets/google
env:
- name: GOOGLE_APPLICATION_CREDENTIALS
value: /var/secrets/google/key.json
ports:
- containerPort: 8080
imagePullSecrets:
- name: imagepullsecretkey
我将部署创建为 - kubectl apply -f deployment.yaml
kubectl get pods
NAME READY STATUS RESTARTS AGE
sv-premier-5cc8f599f6-9lrtq 1/1 Running 0 11s
Kubectl describe pods sv-premier-5cc8f599f6-9lrtq
Name: sv-premier-5cc8f599f6-9lrtq
Namespace: default
Priority: 0
Node: docker-desktop/192.168.65.3
Start Time: Tue, 11 Feb 2020 19:04:21 +0530
Labels: app=sv-premier
pod-template-hash=5cc8f599f6
Annotations: <none>
Status: Running
IP: 10.1.0.54
IPs: <none>
Controlled By: ReplicaSet/sv-premier-5cc8f599f6
Containers:
sv-premier:
Container ID: docker://b8993b4fc43197947649c7409b37e6d381a8d4cbbe56e550bca83931747ddd3e
Image: gcr.io/proto/premiercore1:latest
Image ID: docker-pullable://gcr.io/proto/premiercore1@sha256:664778c72c3f79147c4c5b73914292a124009591f479a5e3acf42c444eb62860
Port: 4343/TCP
Host Port: 0/TCP
Command:
/bin/sh
Args:
-c
while true; do echo Done Deploying sv-premier; sleep 3600;done
State: Running
Started: Tue, 11 Feb 2020 19:04:24 +0530
Ready: True
Restart Count: 0
Environment:
GOOGLE_APPLICATION_CREDENTIALS: /var/secrets/google/key.json
Mounts:
/var/run/secrets/kubernetes.io/serviceaccount from default-token-s4jgd (ro)
/var/secrets/google from google-cloud-key (rw)
Conditions:
Type Status
Initialized True
Ready True
ContainersReady True
PodScheduled True
Volumes:
google-cloud-key:
Type: Secret (a volume populated by a Secret)
SecretName: gcp-key
Optional: false
default-token-s4jgd:
Type: Secret (a volume populated by a Secret)
SecretName: default-token-s4jgd
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
---- ------ ---- ---- -------
Normal Scheduled 67s default-scheduler Successfully assigned default/sv-premier-5cc8f599f6-9lrtq to docker-desktop
Normal Pulling 66s kubelet, docker-desktop Pulling image "gcr.io/proto/premiercore1:latest"
Normal Pulled 64s kubelet, docker-desktop Successfully pulled image "gcr.io/proto/premiercore1:latest"
Normal Created 64s kubelet, docker-desktop Created container sv-premier
Normal Started 64s kubelet, docker-desktop Started container sv-premier
为什么我会得到这个——
Tolerations: node.kubernetes.io/not-ready:NoExecute for 300s
node.kubernetes.io/unreachable:NoExecute for 300s
比我更有经验的人好心帮忙
注意Kubernetes 会自动添加对
node.kubernetes.io/not-ready
和node.kubernetes.io/unreachable
的容忍度。Kubernetes 自动添加对 node.kubernetes.io/not-ready 容忍秒=300,除非 pod 用户提供的配置已经容忍 node.kubernetes.io/not-ready。同样,它增加了对 node.kubernetes.io/unreachable 容忍秒=300,除非 用户提供的 Pod 配置已经可以容忍 node.kubernetes.io/unreachable。
这些自动添加的容差 确保默认 Pod 行为保持绑定 5 分钟 检测到这些问题之一后,将保持维护。
在此处阅读完整详细信息
内置了以下污点:
node.kubernetes.io/not-ready: Node is not ready
.这对应于 NodeCondition Ready 为"False"。
node.kubernetes.io/unreachable
:节点控制器无法访问节点。这对应于节点条件就绪为"未知"。
更多如下:
node.kubernetes.io/out-of-disk
:节点从磁盘中消失。
node.kubernetes.io/memory-pressure
:节点有内存压力。
node.kubernetes.io/disk-pressure
:节点具有磁盘压力。
node.kubernetes.io/network-unavailable
:节点的网络不可用。
node.kubernetes.io/unschedulable
:节点不可调度。
node.cloudprovider.kubernetes.io/uninitialized
:当 kubelet 使用"外部"云提供商启动时,会在节点上设置此污点以将其标记为不可用。在来自云控制器管理器的控制器初始化此节点后,kubelet 会删除此污点。