你好,我遇到这个问题时,我的pod使用gitRepo卷,从书Kubernetes在行动例子
以下是我部署文件
apiVersion: apps/v1
kind: Deployment
metadata:
name: gitrepo-vol-deploy
namespace: book
spec:
replicas: 1
selector:
matchLabels:
app: git-repo-as-vol-1
type: volumes
template:
metadata:
labels:
app: git-repo-as-vol-1
type: volumes
spec:
containers:
- image: nginx
name: web-server
volumeMounts:
- name: html
mountPath: /usr/share/nginx/html
readOnly: true
ports:
- containerPort: 80
protocol: TCP
volumes:
- name: html
gitRepo:
repository: git@github.com:xxxxxx/kubia-website-example.git
revision: master
directory: .
我的窗格状态
k8s@GSG1PM-FT1057:~$ n book
NAME READY STATUS RESTARTS AGE
deploy-kubia-app-7d6fb9cb8-rvrrv 1/1 Running 4 (14h ago) 15d
gitrepo-vol-deploy-b59f686cf-hzlts 0/1 ContainerCreating 0 30m
rs-kubia-app-6jjpm 1/1 Running 4 (14h ago) 15d
vol-1-7956876664-5f48q 2/2 Running 0 93m
这是我的舱描述
Containers:
web-server:
Container ID:
Image: nginx
Image ID:
Port: 80/TCP
Host Port: 0/TCP
State: Waiting
Reason: ContainerCreating
Ready: False
Restart Count: 0
Environment: <none>
Mounts:
/usr/share/nginx/html from html (ro)
/var/run/secrets/kubernetes.io/serviceaccount from kube-api-access-bln48 (ro)
Conditions:
Type Status
Initialized True
Ready False
ContainersReady False
PodScheduled True
Volumes:
html:
Type: GitRepo (a volume that is pulled from git when the pod is created)
Repository: git@github.com:xxxxxx/kubia-website-example.git
Revision: master
kube-api-access-bln48:
Type: Projected (a volume that contains injected data from multiple sources)
TokenExpirationSeconds: 3607
ConfigMapName: kube-root-ca.crt
ConfigMapOptional: <nil>
DownwardAPI: true
QoS Class: BestEffort
Node-Selectors: <none>
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
---- ------ ---- ---- -------
Normal Scheduled 11m default-scheduler Successfully assigned book/gitrepo-vol-deploy-b59f686cf-hzlts to minikube
Warning FailedMount 7m12s kubelet Unable to attach or mount volumes: unmounted volumes=[html], unattached volumes=[kube-api-access-bln48 html]: timed out waiting for the condition
Warning FailedMount 74s (x13 over 11m) kubelet MountVolume.SetUp failed for volume "html" : failed to exec 'git clone -- git@github.com:xxxxx/kubia-website-example.git .': : executable file not found in $PATH
Warning FailedMount 22s (x4 over 9m27s) kubelet Unable to attach or mount volumes: unmounted volumes=[html], unattached volumes=[html kube-api-access-bln48]: timed out waiting for the condition
在pod描述事件中,它声明了这一点,有人能帮助我哪里错了吗?提前感谢。
Warning FailedMount 7m12s kubelet Unable to attach or mount volumes: unmounted volumes=[html], unattached volumes=[kube-api-access-bln48 html]: timed out waiting for the condition
使用Git存储库作为卷的起点。
1条答案
按热度按时间cyvaqqii1#
看起来根本原因实际上是写在事件中的。当你对你的repo进行git克隆时,它会说:
“在$PATH中找不到可执行文件”
您使用的nginx映像不包含git可执行文件,因此您可以基于nginx创建自己的Docker映像: