我是 Kubernetes 新手。
以下是我正在运行的 yaml:
---
apiVersion: v1
kind: Service
metadata:
labels:
app.kubernetes.io/name: k8-demo-aishwarya
app.kubernetes.io/version: version1
name: k8-demo-aishwarya
spec:
ports:
- name: http
port: 80
targetPort: 80
selector:
app.kubernetes.io/name: k8-demo-aishwarya
app.kubernetes.io/version: version1
type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app.kubernetes.io/name: k8-demo-aishwarya
app.kubernetes.io/version: version1
name: k8-demo-aishwarya
spec:
replicas: 1
selector:
matchLabels:
app.kubernetes.io/name: k8-demo-aishwarya
app.kubernetes.io/version: version1
template:
metadata:
labels:
app.kubernetes.io/name: k8-demo-aishwarya
app.kubernetes.io/version: version1
spec:
containers:
- env:
- name: KUBERNETES_NAMESPACE
valueFrom:
fieldRef:
fieldPath: metadata.namespace
image: docker.io/aishvaryaps/spring-boot-on-kubernetes-example:0.12-SNAPSHOT
imagePullPolicy: IfNotPresent
name: k8-demo-aishwarya
ports:
- containerPort: 80
name: http
protocol: TCP
收到 crashloopbackoff 错误
谁能指导我?
图像没有问题,它运行正常,我已经在 Docker 上测试过了。
Kubernetes pod 日志如下:
1. Successfully assigned default/k8-demo-aishwarya-fdd8d58c6-lvxp9 to gke-cluster-3-pool-1-997819b9-j3b2
2. Container image "docker.io/aishvaryaps/spring-boot-on-kubernetes-example:0.12-SNAPSHOT" already present on machine
3. Created container k8-demo-aishwarya
4. Started container k8-demo-aishwarya
5. Back-off restarting failed container