正在学习k8s,到了卷这一章,提到了gitRepo卷(我知道它已经过期了,但还是想了解试试)
自己在实践的过程中,pod一直卡在ContainerCreating
状态下。通过查看pod信息,发现有报错,想请教一下各位大佬,问题出在哪里(虔诚鞠躬.gif)。
基于 Centos8操作系统、minikube运行环境, 本机git版本为 git version 2.27.0
报错内容如下:
Events:
Type Reason Age From Message
---- ------ ---- ---- -------
Normal Scheduled 49s default-scheduler Successfully assigned default/gitrepo-volume-pod to minikube
Warning FailedMount 17s (x7 over 49s) kubelet MountVolume.SetUp failed for volume "html" : failed to exec 'git clone -- https://github.com/luksa/kubia-website-example.git .': : executable file not found in $PATH
我使用的yaml文件如下:
apiVersion: v1
kind: Pod
metadata:
name: gitrepo-volume-pod
spec:
containers:
- image: nginx:alpine
name: web-server
volumeMounts:
- mountPath: /usr/share/nginx/html
name: html
readOnly: true
ports:
- containerPort: 80
protocol: TCP
volumes:
- name: html
gitRepo: #你正在创建一个gitRepo卷
repository: https://github.com/luksa/kubia-website-example.git #这个卷克隆至一个Git仓库
revision: master #使用那个主分支
directory: . #将repo克隆到卷的根目录,即/usr/share/nginx/html/
找不到 git 命令.
你好像是在用 minikube 。minikube 我没用过,不过好像他是自己起了一个 containter ,然后在里面搭建 k8s 环境的。这样的话,你的“本机”上的 git 就不重要了,问题是 minikube 的 container 里有 git 命令吗?