有没有办法在ConfigMap中指定int
值?当我尝试指定端口号时,会收到以下错误信息。
error: error validating "my-deployment.yml": error validating data: expected type int, for field spec.template.spec.containers[0].ports[0].containerPort, got string; if you choose to ignore these errors, turn validation off with --validate=false
以下是我正在使用的示例配置文件:
apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: my-service
spec:
replicas: 2
template:
metadata:
labels:
app: poweramp-email-service
spec:
containers:
- name: poweramp-email-service
env:
- name: SERVICE_PORT_NUM
valueFrom:
configMapKeyRef:
name: stg-config
key: poweramp-email-service.port
image: nginx
ports:
- containerPort: my-service.port
以下是我使用的简单的stg.properties
文件,用于使用命令生成ConfigMap:kubectl create configmap stg-config --from-file stg.properties
my-service.port=9513