does any one has an idea how to execute MySQL command inside Kubernetes POD from GitLab Runner?
My Problem: I want to create two View Table for my Database that is setup and ready inside a GitLab Pipeline.
My current approach:
1 I read out the wordpress pod infos
MSPOD=$(kubectl get pods --namespace=default -o=jsonpath="{.items[*].metadata.name}" -l app=wordpress,tier=mysql)
2 I try to execute the create table view as single command as i can not sh into the POD via Runner.
kubectl exec $MSPOD -- mysql --database=wordpress --password='M*****?' -e "CREATE VIEW ...;"
But this does not work it actully tries to run the single items of the command in the Terminal. It also does not work as a embedded execution
kubectl exec $MSPOD -- $(mysql --database=wordpress --password='M*****?' -e "CREATE VIEW ...;")
Causing the same error.
The init container with MySQL client should work for you. Your SQL code can be provided as a configmap.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.