Asking for help? Comment out what you need so we can get more information to help you!
Cluster information:
Kubernetes master is running at https://10.1.1.132:6443
KubeDNS is running at https://10.1.1.132:6443/api/v1/namespaces/kube-system/services/kube-dns:dns/proxy
Kubernetes version: Client Version: version.Info{Major:“1”, Minor:“14”, GitVersion:“v1.14.2”, GitCommit:“66049e3b21efe110454d67df4fa62b08ea79a19b”, GitTreeState:“clean”, BuildDate:“2019-05-16T16:23:09Z”, GoVersion:“go1.12.5”, Compiler:“gc”, Platform:“linux/amd64”}
Server Version: version.Info{Major:“1”, Minor:“14”, GitVersion:“v1.14.2”, GitCommit:“66049e3b21efe110454d67df4fa62b08ea79a19b”, GitTreeState:“clean”, BuildDate:“2019-05-16T16:14:56Z”, GoVersion:“go1.12.5”, Compiler:“gc”, Platform:“linux/amd64”
Cloud being used: (put bare-metal if not on a public cloud) On-Prem
Installation method: https://github.com/SubhakarKotta/k8s-installation-centos
Host OS: CentOS Linux 7
CNI and version:
CRI and version: crictl version v1.12.0
You can format your yaml by highlighting it and pressing Ctrl-Shift-C, it will make your output easier to read.
apiVersion: apps/v1
kind: Deployment
metadata:
name: my-deploy
spec:
replicas: 1
selector:
matchLabels:
app: my-app
template:
metadata:
labels:
app: my-app
spec:
containers:
- name: my-container
image: docker-hub-dev.blueally.com/c7-sentinel12:1.0.0.0
volumeMounts:
- name: my-config # Must be the same as the volume name bellow
mountPath: /opt/my-container/config
volumes:
- name: my-config
configMap:
name: my-script-config # The name of the ConfigMap
defaultMode: 0777 # We need execution mode for the file
- secretRef:
name: my-secret
```
apiVersion: v1
kind: ConfigMap
metadata:
name: my-script-config
data:
my-script.sh: |
#!/bin/sh
echo "Hi there - runing my-script..."
cat /etc/hosts
echo "Thats it! thats all my script"
```
My question is listed below:
- If i run the deployment - A file with the name my-script.sh will be placed in the container in the path specified in the VolumeMounts. But the file will be only placed in the container - it is not executing the script before the image entrypoint
- because i want to keep my configuration files as a script in the Master node and it has to be automatically override the image entrypoint to apply the new configuration on top of the existing one.
Can someone please help me on this?