Kubernetes 而我';我试图在yaml文件下运行,但有一个错误是;在此上下文中,第10行第14列不允许使用映射值;
问题是你想要的地方有一个“-”(a) 我猜你是在一个文本编辑器中写的,它会自动进行“智能”替换,比如Kubernetes 而我';我试图在yaml文件下运行,但有一个错误是;在此上下文中,第10行第14列不允许使用映射值;,kubernetes,yaml,minikube,Kubernetes,Yaml,Minikube,问题是你想要的地方有一个“-”(a) 我猜你是在一个文本编辑器中写的,它会自动进行“智能”替换,比如“到”,当你键入-时,你得到的是-。如果是这样的话,那么确保这些功能被关闭或切换到“程序员编辑器”是值得的像Visual Studio代码、升华文本、Atom、Vim等 要解决此问题,请将第9、28和31行上的连字符替换为连字符(并确保编辑器不会覆盖它们): 问题是你想要的地方有一个“-”(a) 我猜你是在一个文本编辑器中写的,它会自动进行“智能”替换,比如“到”,当你键入-时,你得到的是-。如果
“
到”
,当你键入-
时,你得到的是-
。如果是这样的话,那么确保这些功能被关闭或切换到“程序员编辑器”是值得的像Visual Studio代码、升华文本、Atom、Vim等
要解决此问题,请将第9、28和31行上的连字符替换为连字符(并确保编辑器不会覆盖它们):
问题是你想要的地方有一个“-”(a) 我猜你是在一个文本编辑器中写的,它会自动进行“智能”替换,比如
“
到”
,当你键入-
时,你得到的是-
。如果是这样的话,那么确保这些功能被关闭或切换到“程序员编辑器”是值得的像Visual Studio代码、升华文本、Atom、Vim等
要解决此问题,请将第9、28和31行上的连字符替换为连字符(并确保编辑器不会覆盖它们):
apiVersion: v1
kind: Service
metadata:
name: my-emp
labels:
run: my-emp
spec:
ports:
– port: 80
protocol: TCP
targetPort: 8888
type: NodePort
selector:
run: my-emp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-emp
spec:
replicas: 2
template:
metadata:
labels:
run: my-emp
spec:
containers:
– name: my-emp
image: kavisuresh/employee
ports:
– containerPort: 8888
apiVersion: v1
kind: Service
metadata:
name: my-emp
labels:
run: my-emp
spec:
ports:
- port: 80
protocol: TCP
targetPort: 8888
type: NodePort
selector:
run: my-emp
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-emp
spec:
replicas: 2
template:
metadata:
labels:
run: my-emp
spec:
containers:
- name: my-emp
image: kavisuresh/employee
ports:
- containerPort: 8888