【发布时间】:2019-12-05 14:30:06
【问题描述】:
我是 DevOps 的新手。我为刚刚在 Digital Oceans 上创建的 Kubernetes 集群编写了一个 deployment.yaml 文件。创建部署时不断出现我现在无法解码的错误。这只是一个测试部署,为我公司的 web 应用程序迁移到 kubernetes 做准备。
我尝试编辑部署的内容,使其看起来像我找到的传统示例。我什至无法让这个简单的例子工作。您可以在下面找到 deployment.yaml 内容。
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: testit-01-deployment
spec:
replicas: 4
#number of replicas generated
selector:
#assigns labels to the pods for future selection
matchLabels:
app: testit
version: v01
template:
metadata:
Labels:
app: testit
version: v01
spec:
containers:
-name: testit-container
image: teejayfamo/testit
ports:
-containerPort: 80
我在文件夹容器中的 cmd 上运行了这一行:
kubectl apply -f deployment.yaml --validate=false
来自服务器的错误(BadRequest):创建“deployment.yaml”时出错: 版本“v1”中的部署不能作为部署处理: v1.Deployment.Spec: v1.DeploymentSpec.Template: v1.PodTemplateSpec.Spec:v1.PodSpec.Containers:[]v1.Container:解码 切片:期望 [ 或 n,但发现 {,在 #10 字节中发现错误 ...|tainers":{"-name":"t|..., 更大的上下文 ...|:"testit","version":"v01"}},"spec":{"containers":{"-name":"testit-container","image":"teejayfamo/tes|。 ..
我什至无法从搜索中获得任何有关此的信息。我不能只创建部署。请问,谁能理解并帮我解决?
【问题讨论】:
-
请粘贴您收到的整个错误消息。
标签: docker deployment kubernetes