如何在使用"Kubeadm"进行"Kubernetes"时通过"Skaffold"使用本地集群?



我试图在本地Kubernetes集群上部署我的NodeJS应用程序,使用skaffold,但我得到以下结果:

DEBU[0018] Pod "expiration-depl-7989dc5ff4-lkpvw" scheduled but not ready: checking container statuses  subtask=-1 task=DevLoop
DEBU[0018] marking resource failed due to error code STATUSCHECK_IMAGE_PULL_ERR  subtask=-1 task=Deploy
- deployment/expiration-depl: container expiration is waiting to start: learnertester/expiration:8c6b05f89e0abe8e6a33da266355cf79713e6bd22d1abda0da5541f24d5d8d9e can't be pulled
- pod/expiration-depl-7989dc5ff4-lkpvw: container expiration is waiting to start: learnertester/expiration:8c6b05f89e0abe8e6a33da266355cf79713e6bd22d1abda0da5541f24d5d8d9e can't be pulled
- deployment/expiration-depl failed. Error: container expiration is waiting to start: learnertester/expiration:8c6b05f89e0abe8e6a33da266355cf79713e6bd22d1abda0da5541f24d5d8d9e can't be pulled.
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] pod statuses could not be fetched this time due to following errors occurred context canceled  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] pod statuses could not be fetched this time due to following errors occurred context canceled  subtask=-1 task=Deploy
DEBU[0018] marking resource status check cancelledSTATUSCHECK_USER_CANCELLED  subtask=-1 task=Deploy
DEBU[0018] setting skaffold deploy status to STATUSCHECK_IMAGE_PULL_ERR.  subtask=-1 task=Deploy
Cleaning up...
DEBU[0018] Running command: [kubectl --context kubernetes-admin@kubernetes delete --ignore-not-found=true --wait=false -f -]  subtask=-1 task=DevLoop
- deployment.apps "auth-depl" deleted
- service "auth-srv" deleted
- deployment.apps "auth-mongo-depl" deleted
- service "auth-mongo-srv" deleted
- deployment.apps "client-depl" deleted
- service "client-srv" deleted
- deployment.apps "expiration-depl" deleted
- deployment.apps "expiration-redis-depl" deleted
- service "expiration-redis-srv" deleted
- ingress.networking.k8s.io "ingress-service" deleted
- deployment.apps "nats-depl" deleted
- service "nats-srv" deleted
- deployment.apps "orders-depl" deleted
- service "orders-srv" deleted
- deployment.apps "orders-mongo-depl" deleted
- service "orders-mongo-srv" deleted
- deployment.apps "payments-depl" deleted
- service "payments-srv" deleted
- deployment.apps "payments-mongo-depl" deleted
- service "payments-mongo-srv" deleted
- deployment.apps "tickets-depl" deleted
- service "tickets-srv" deleted
- deployment.apps "tickets-mongo-depl" deleted
- service "tickets-mongo-srv" deleted
INFO[0054] Cleanup completed in 35.7 seconds             subtask=-1 task=DevLoop
DEBU[0054] Running command: [tput colors]                subtask=-1 task=DevLoop
DEBU[0054] Command output: [256
]                        subtask=-1 task=DevLoop
1/12 deployment(s) failed

这是expiration-depl.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: expiration-depl
spec:
replicas: 1
selector:
matchLabels:
app: expiration
template:
metadata:
labels:
app: expiration
spec:
containers:
- name: expiration
image: learnertester/expiration
env:
- name: NATS_CLIENT_ID
valueFrom:
fieldRef:
fieldPath: metadata.name
- name: NATS_URL
value: 'http://nats-srv:4222'
- name: NATS_CLUSTER_ID
value: ticketing
- name: REDIS_HOST
value: expiration-redis-srv

expiration-redis-depl.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
name: expiration-redis-depl
spec:
replicas: 1
selector:
matchLabels:
app: expiration-redis
template:
metadata:
labels:
app: expiration-redis
spec:
containers:
- name: expiration-redis
image: redis
---
apiVersion: v1
kind: Service
metadata:
name: expiration-redis-srv
spec:
selector:
app: expiration-redis
ports:
- name: db
protocol: TCP
port: 6379
targetPort: 6379

信息
  • Skaffold version: v2.0.3
  • 操作系统:Ubuntu 22.04 LTS
  • 安装方式:Snap
  • skaffold.yaml:
  • 目录
apiVersion: skaffold/v2alpha3
kind: Config
deploy:
kubectl: 
manifests:
- ./infra/k8s/*
build:
local:
push: false
artifacts:
- image: learnertester/auth
context: auth
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .
- image: learnertester/ticketing-client
context: client
docker:
dockerfile: Dockerfile
sync:
manual:
- src: '**/*.js'
dest: .
- image: learnertester/tickets
context: tickets
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .
- image: learnertester/orders
context: orders
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .
- image: learnertester/expiration
context: expiration
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .
- image: learnertester/payments
context: payments
docker:
dockerfile: Dockerfile
sync:
manual:
- src: 'src/**/*.ts'
dest: .

首先,你使用的是什么"本地Kubernetes"?

在skaffold的deploy部分。您需要指定要用于部署的k8s上下文,如下所示:

deploy:
kubeContext: minikube

查看您的机器上可用的k8s上下文,键入:

kubectl config get-contexts

相关内容

  • 没有找到相关文章

最新更新