I have created configmap using setenv.sh file with name configmap-setenv
.I just want to consume this configmap in one of my replicationcontroller.
apiVersion: v1
kind: ReplicationController
metadata:
name: sample-registrationweb-rc
spec:
replicas: 1
selector:
app: "JWS"
role: "FO-registrationweb"
tier: "app"
template:
metadata:
labels:
app: "JWS"
role: "FO-registrationweb"
tier: "app"
spec:
containers:
- name: jws
image: samplejws/demo:v1
imagePullPolicy: Always
ports:
- name: jws
containerPort: 8080
resources:
requests:
cpu: 1000m
memory: 100Mi
limits:
cpu: 2000m
memory: 7629Mi
volumeMounts:
- mountPath: /opt/soft/jws-3.0/tomcat8/bin
name: tomcatbin
volumes:
- name: data
emptyDir: {}
- configMap:
name: tomcatbin
name: configmap-setenv
items:
- key: setenv.sh
path: setenv.sh
I am getting below error during creation fo replicationcontroller.
error validating "registartion-rc.yaml": error validating data: found invalid field configMap for v1.Volume; if you choose to ignore these errors, turn validation off with --validate=false
You have a syntax error. A newer version of kubectl
would give you a more specific error: yaml: line 40: mapping values are not allowed in this context
The configmap volume mount should look like:
volumes:
- name: tomcatbin
configMap:
name: configmap-setenv
items:
- key: setenv.sh
path: setenv.sh