Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow mysql-router-k8s to be exposed outside of Kubernetes cluster #137

Open
phvalguima opened this issue Sep 5, 2023 · 7 comments
Open

Comments

@phvalguima
Copy link
Contributor

Mysql router should provide means to provide access outside of the kubernetes cluster.

That can be achieved with a load balancer, for example:

$ cat <<EOF | kubectl apply -f -
apiVersion: v1
kind: Service
metadata:
  name: mysql-router
  namespace: mysql
spec:
  type: LoadBalancer
  ports:
  - name: mysql-rw
    targetPort: 6446
    port: 6446
    protocol: TCP
  - name: mysql-ro
    port: 6447
    protocol: TCP
    targetPort: 6447
  selector:
    app.kubernetes.io/name: mysql-router
EOF
@github-actions
Copy link
Contributor

github-actions bot commented Sep 5, 2023

@carlcsaposs-canonical
Copy link
Contributor

Does data-integrator meet some/all of your requirements?

@phvalguima
Copy link
Contributor Author

Hi @carlcsaposs-canonical, unfortunately, no. Data integrator sets up the credentials, but we need to actually expose the mysql-router-k8s service.

@carlcsaposs-canonical
Copy link
Contributor

Does juju expose help with that?

@taurus-forever
Copy link
Contributor

taurus-forever commented Sep 7, 2023

Does juju expose help with that?

AFAIK, no. juju expose is about firewall.
This should do the job juju deploy mysql-router-k8s --config kubernetes-service-type=LoadBalancer
but "it doesn't work (c) @phvalguima"

Juju 3.1.6:

juju deploy mysql-k8s --channel 8.0/edge --trust --config kubernetes-service-type=loadbalancer
juju deploy mysql-router-k8s --trust --channel 8.0/edge --config kubernetes-service-type=loadbalancer

> kubectl get service -o wide -n smoke-test
NAME                         TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                       AGE    SELECTOR
modeloperator                ClusterIP   10.152.183.252   <none>        17071/TCP                     35h    operator.juju.is/name=modeloperator,operator.juju.is/target=model
mysql-router-k8s-endpoints   ClusterIP   None             <none>        <none>                        6m6s   app.kubernetes.io/name=mysql-router-k8s
mysql-router-k8s             ClusterIP   10.152.183.96    <none>        6446/TCP,6447/TCP,65535/TCP   6m6s   app.kubernetes.io/name=mysql-router-k8s
mysql-k8s                    ClusterIP   10.152.183.32    <none>        65535/TCP                     12s    app.kubernetes.io/name=mysql-k8s
mysql-k8s-endpoints          ClusterIP   None             <none>        <none>                        11s    app.kubernetes.io/name=mysql-k8s

@phvalguima
Copy link
Contributor Author

Hi @taurus-forever, I also thought we could use that config, however, Juju team informed me that is only available for an older format of container apps called podspec in Juju. I also tried myself, and it did not work on k8s.
Here is the full chat: https://chat.charmhub.io/charmhub/pl/o6kqtisokjdd3n9wenhew4icfc

So, the only way is to expose is by patching the k8s service itself.

@carlcsaposs-canonical
Copy link
Contributor

AFAIK, no. juju expose is about firewall.

I read the linked information differently, but I think I might be misunderstanding something

[...] an Ingress Resource is used to route http traffic via the cluster’s ingress controller to the service. This is what juju expose currently does when run.

github-actions bot added a commit to carlcsaposs-canonical/mysql-router-k8s-operator that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants