Run a mysql client pod in kubernetes
This command will create a new pod named « mysql-client » and start a bash session inside the container running the MySQL client image.
kubectl run mysql-client --image=mysql:8.0 -it --rm --restart=Never -- /bin/bash
Here’s a breakdown of the command:
kubectl run: This command is used to create a new pod or deployment in Kubernetes.mysql-client: This is the name of the pod that will be created.--image=mysql:8.0: This specifies the Docker image to use for the container.-it: This starts an interactive terminal session inside the container.--rm: This flag specifies that the container should be removed after it exits.--restart=Never: This specifies that the pod should not be restarted if it stops running for any reason.-- /bin/bash: This starts a bash session inside the container.
Once the command is executed, you should see a bash prompt inside the container. From there, you can run MySQL commands to interact with your MySQL server.