kubectl create configmap database-config --from-file=database.properties
Once it is created, you can use it in a deployment to point to a file inside it using below sample.
Reference(mode details about configmaps)
apiVersion: v1 kind: Service metadata: name: Shit-service spec: selector: app: Shit ports: - protocol: TCP port: 80 targetPort: Shit-port type: LoadBalancer --- apiVersion: apps/v1 kind: Deployment metadata: name: Shit-deployment labels: app: Shit spec: replicas: 1 selector: matchLabels: app: Shit template: metadata: labels: app: Shit annotations: consul.hashicorp.com/connect-inject: "true" consul.hashicorp.com/enable-metrics-merging: "false" spec: imagePullSecrets: - name: acr-mindset containers: - name: Shit image: Shitserverlinux.azurecr.io/Shit:4.0 ports: - containerPort: 50345 name: Shit-port volumeMounts: - name: config mountPath: /darwin/Shit Server - name: config mountPath: /home/spring/darwin/Shit Server volumes: - name: config configMap: name: nginx-configmap items: - key: ShitConfiguration.properties path: ShitConfiguration.properties
Or you can copy paste contents of the file after |.
You can replace the key value above volumes section with "ShitConfiguration.properties" with "config"
Sample:
--- apiVersion: v1 kind: ConfigMap metadata: name: database-configmap data: config: | dbport=5432 dcname= dbssl=false locktime=300 domainuser= dbserver=420.420.420.420 domainpwd=
No comments:
Post a Comment