使用:
支架 1.4.0
minikube 1.6.2
kubectl:客户端 1.15.5 和服务器 1.17.0
Django 3.0.3
Python 3.8.2
我最近在处理 Django API 时才开始收到此错误。每当我在进行更改后保存时,我都会得到:
WARN[0234] Skipping deploy due to sync error: copying files: Running [kubectl --context minikube exec api-deployment-6946878554-n7lc2 --namespace default -c api -i -- tar xmf - -C / --no-same-owner]
- stdout:
- stderr: error: unable to upgrade connection: container not found ("api")
: exit status 1
不知道是什么改变导致了这种情况。我必须CTRL + C
关闭 Skaffold 并重新启动它以反映更改。
这是我的skaffold.yaml
:
apiVersion: skaffold/v1beta15
kind: Config
build:
local:
push: false
artifacts:
- image: postgres
context: postgres
docker:
dockerfile: Dockerfile.dev
sync:
manual:
- src: "***/*.sql"
dest: .
- image: testappacr.azurecr.io/test-app-api
context: api
docker:
dockerfile: Dockerfile.dev
sync:
manual:
- src: "***/*.py"
dest: .
deploy:
kubectl:
manifests:
- manifests/dev-ingress.yaml
- manifests/postgres.yaml
- manifests/api.yaml
还有api.yaml
:
apiVersion: apps/v1
kind: Deployment
metadata:
name: api-deployment
spec:
replicas: 3
selector:
matchLabels:
component: api
template:
metadata:
labels:
component: api
spec:
containers:
- name: api
image: testappacr.azurecr.io/test-app-api
ports:
- containerPort: 5000
env:
- name: PGUSER
valueFrom:
secretKeyRef:
name: test-app-secrets
key: PGUSER
- name: PGHOST
value: postgres-cluster-ip-service
- name: PGPORT
value: "1423"
- name: PGDATABASE
valueFrom:
secretKeyRef:
name: test-app-secrets
key: PGDATABASE
- name: PGPASSWORD
valueFrom:
secretKeyRef:
name: test-app-secrets
key: PGPASSWORD
- name: SECRET_KEY
valueFrom:
secretKeyRef:
name: test-app-secrets
key: SECRET_KEY
- name: DEBUG
valueFrom:
secretKeyRef:
name: test-app-secrets
key: DEBUG
livenessProbe:
tcpSocket:
port: 5000
initialDelaySeconds: 2
periodSeconds: 2
readinessProbe:
tcpSocket:
port: 5000
initialDelaySeconds: 2
periodSeconds: 2
volumeMounts:
- mountPath: "/mnt/test-app"
name: file-storage
volumes:
- name: file-storage
persistentVolumeClaim:
claimName: file-storage
---
apiVersion: v1
kind: Service
metadata:
name: api-cluster-ip-service
spec:
type: ClusterIP
selector:
component: api
ports:
- port: 5000
targetPort: 5000
关于这里可能发生的事情有什么建议吗?