Kubesphere sets mysql network mapping

First of all, we already have a mysql pod container (workload) insert image description hereKubesphere system will deploy a service for our system by default, we can delete this service first (do not delete the corresponding workload), and then recreate our service. insert image description hereWhen creating, we need to select Create a service based on a particular workload. insert image description hereWe first create workloads based on mysql's internal network. insert image description hereThen we select the corresponding stateful replica set (mysql) and set the corresponding service information we need.
Since it is internal network access, we do not need to set the corresponding ip information, we can choose the internal domain name to set our network situation, and set 3306 as our port mapping (mapping to the pod container).

insert image description hereThen we only need to keep clicking next until the services are created successfully, and we can see the following page. insert image description hereAccording to the dns information in the left menu bar, we enter the pod and use the mysql-server-in.his in the dns information to connect to the mysql service.
The specific commands are as follows:
Mysql -h mysql-server-in.his -u root -p

insert image description hereWe can see that we can directly access network resources through the pod of the internal network according to the dns information of the service.

Next we need to configure the extranet

Still create a specified workload in services. .

insert image description here
To expose specific port information, select a specific workload, and select the virtual ip address mode, we need to map the virtual ip address to access the pod container from the external network.
insert image description here
Among them, we need to set the mode to node port mode.
When the container is created, we can see that there is one more component information in our service list

insert image description here
We can see that our port 3306 can be mapped to port 31565, and we try to access port 31565 of our server through the external network.
insert image description here
We can see that our network can be accessed normally.
Therefore, the mapping of the internal container pod to the external network can be realized through the configuration of the server.

Guess you like

Origin blog.csdn.net/qq_27180763/article/details/123704729