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

Ingress udp/tcp not working and therefore cannot access the service #19905

Open
wusunny2022 opened this issue Nov 4, 2024 · 2 comments
Open
Assignees
Labels
kind/support Categorizes issue or PR as a support question.

Comments

@wusunny2022
Copy link

What Happened?

Description:
Ingress is not natively support routing of udp/tcp, so need to handle another way. But this is not work in minikube of below procedure.

Procedure of reproduce the issue:

  1. I have mysql-statuefulset.yaml
apiVersion: v1
kind: ConfigMap
metadata:
  name: mysql-initdb-config
data:
  init.sql: |
    CREATE DATABASE IF NOT EXISTS mydb;
---
apiVersion: apps/v1
kind: StatefulSet
metadata:
  name: my-mysql-stateful-set
  namespace: my-test-app
spec:
  replicas: 1
  selector:
    matchLabels:
      app: my-mysql
  serviceName: my-mysql
  template:
    metadata:
      labels:
        app: my-mysql
    spec:
      containers:
      - name: mysql
        image: mysql:8.3
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: root
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
        - name: mysql-initdb
          mountPath: /docker-entrypoint-initdb.d
      volumes:
        - name: mysql-initdb
          configMap:
            name: mysql-initdb-config
  volumeClaimTemplates:
  - metadata:
      name: mysql-persistent-storage
    spec:
      accessModes: [ "ReadWriteOnce" ]
      resources:
        requests:
          storage: 1Gi

---
apiVersion: v1
kind: Service
metadata:
  name: mysql-service
  namespace: my-test-app
spec:
  type: ClusterIP
  selector:
    app: my-mysql
  ports:
    - protocol: TCP
      port: 3306
      targetPort: 3306
  1. Enable ingress-controller in minikube by minikube addons enable ingress
  2. Have gone through the below solution
    3.1 official solution: https://minikube.sigs.k8s.io/docs/tutorials/nginx_tcp_udp_ingress/
    3.2 Solutions provided by the commentators
    Minikube Ingress TCP Services Not Forwarding Traffic #2840
  3. Run minikube tunnel to enable the access
  4. Connect mysql through localhost:3306
  5. Cannot connect

Attach the log file

1

Operating System

macOS (Default)

Driver

Docker

@kundan2707
Copy link
Contributor

/kind support

@k8s-ci-robot k8s-ci-robot added the kind/support Categorizes issue or PR as a support question. label Nov 4, 2024
@kundan2707
Copy link
Contributor

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/support Categorizes issue or PR as a support question.
Projects
None yet
Development

No branches or pull requests

3 participants