I am experimenting with the above mentioned tools right now and ran into some issues. I cannot forward my ports, because it seems like I am having some problems with the ip-tables of my pod.
"sudo iptables -P FORWARD ACCEPT" is supposed to get rid of my problems, but I wonder, how I can insert that command in my yaml-file so that it is going to be executed,
before my pod wants to get the database. Am I right with that?
Maybe you can help me sorting out where to place the code and how to implement the commad.
Best regards!!!!
apiVersion: apps/v1
kind: Deployment
metadata:
name: mysql-deployment
spec:
replicas: 1
selector:
matchLabels:
app: my-mysql
initContainers:
- name: forward accept
command: ["sudo iptables"]
args: ["-P", "FORWARD ACCEPT"]
template:
metadata:
labels:
app: my-mysql
spec:
volumes:
- name: data-volume
emptyDir: {}
initContainers:
- name: init-container-data-downloader
image: curlimages/curl
args:
- "-o"
- "/tmp/data/init.sql"
- "https://google.de"
volumeMounts:
- mountPath: /tmp/data/
name: data-volume
containers:
- name: mysql
image: mysql
volumeMounts:
- mountPath: /docker-entrypoint-initdb.d/
name: data-volume
env:
- name: MYSQL_ROOT_PASSWORD
value: "mysecretpw"
- name: MYSQL_DATABASE
value: "sportsdb"
ports:
- containerPort: 3306
- containerPort: 33060