quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

from *v1.Ingress: selector for *v1.Ingress not implemented #39936

Closed jxtpro closed 7 months ago

jxtpro commented 7 months ago

Describe the bug

---
apiVersion: v1
kind: Service
metadata:
  annotations:
    app.quarkus.io/quarkus-version: 3.9.1
    app.quarkus.io/build-timestamp: 2024-04-08 - 03:12:44 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
    app.kubernetes.io/managed-by: quarkus
  name: kubernetes-quickstart
spec:
  ports:
    - name: http
      port: 80
      protocol: TCP
      targetPort: 8080
  selector:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
  type: ClusterIP
---
apiVersion: apps/v1
kind: Deployment
metadata:
  annotations:
    app.quarkus.io/quarkus-version: 3.9.1
    app.quarkus.io/build-timestamp: 2024-04-08 - 03:12:44 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
    app.kubernetes.io/managed-by: quarkus
  name: kubernetes-quickstart
spec:
  replicas: 1
  selector:
    matchLabels:
      app.kubernetes.io/version: 1.0.0-SNAPSHOT
      app.kubernetes.io/name: kubernetes-quickstart
  template:
    metadata:
      annotations:
        app.quarkus.io/quarkus-version: 3.9.1
        app.quarkus.io/build-timestamp: 2024-04-08 - 03:12:44 +0000
      labels:
        app.kubernetes.io/managed-by: quarkus
        app.kubernetes.io/version: 1.0.0-SNAPSHOT
        app.kubernetes.io/name: kubernetes-quickstart
    spec:
      containers:
        - env:
            - name: KUBERNETES_NAMESPACE
              valueFrom:
                fieldRef:
                  fieldPath: metadata.namespace
          image: 10.7.0.147:8088/library/demo-app:1.0
          imagePullPolicy: Always
          name: kubernetes-quickstart
          ports:
            - containerPort: 8080
              name: http
              protocol: TCP
---
apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
  annotations:
    app.quarkus.io/quarkus-version: 3.9.1
    app.quarkus.io/build-timestamp: 2024-04-08 - 03:12:44 +0000
  labels:
    app.kubernetes.io/name: kubernetes-quickstart
    app.kubernetes.io/version: 1.0.0-SNAPSHOT
    app.kubernetes.io/managed-by: quarkus
  name: kubernetes-quickstart
spec:
  rules:
    - host: prod.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http
            path: /prod
            pathType: Prefix
    - host: dev.svc.url
      http:
        paths:
          - backend:
              service:
                name: kubernetes-quickstart
                port:
                  name: http
            path: /dev
            pathType: ImplementationSpecific
    - host: alt.svc.url
      http:
        paths:
          - backend:
              service:
                name: updated-service
                port:
                  name: tcpurl
            path: /ea
            pathType: Prefix

curl http://prod.svc.com/prod/hello, 无法获取数据

以下是日志:

kubectl logs ing/kubernetes-quickstart error: cannot get the logs from v1.Ingress: selector for v1.Ingress not implemented

Expected behavior

No response

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

quarkus-bot[bot] commented 7 months ago

/cc @geoand (kubernetes), @iocanel (kubernetes)

geoand commented 7 months ago

I am not sure what the reported problem is here and how it's suppose to relate to Quarkus.

Please improve the description of the issue if you want us to have a deeper look.

Thanks

jxtpro commented 7 months ago

使用mvn创建项目

mvn io.quarkus.platform:quarkus-maven-plugin:3.9.1:create \
    -DprojectGroupId=org.acme \
    -DprojectArtifactId=kubernetes-quickstart \
    -Dextensions='rest,kubernetes,jib'
cd kubernetes-quickstart

添加如下配置:

# server.port
#quarkus.http.port=8888

# harbor
quarkus.container-image.username=admin
quarkus.container-image.password=Harbor12345

# docker image -> 10.7.0.147:8088/quarkus/demo-app:1.0
quarkus.container-image.registry=10.7.0.147:8088
quarkus.container-image.builder=docker

# docker
quarkus.container-image.group=library
quarkus.container-image.name=demo-app
quarkus.container-image.tag=1.0

# k8s
quarkus.kubernetes.replicas=1
quarkus.kubernetes.ingress.expose=true
quarkus.kubernetes.ingress.host=prod.svc.url
quarkus.kubernetes.ports.http.path=/prod

# k8s route rules
quarkus.kubernetes.ingress.rules.1.host=dev.svc.url
quarkus.kubernetes.ingress.rules.1.path=/dev
quarkus.kubernetes.ingress.rules.1.path-type=ImplementationSpecific
quarkus.kubernetes.ingress.rules.2.host=alt.svc.url
quarkus.kubernetes.ingress.rules.2.path=/ea
quarkus.kubernetes.ingress.rules.2.service-name=updated-service
quarkus.kubernetes.ingress.rules.2.service-port-name=tcpurl

运行

./mvnw install -DskipTests

生成了 kubernetes.yml文件 运行

kubectl apply -f target/kubernetes/kubernetes.yml

如下:

❯ kubectl get pod,deploy,svc,ing,pv,pvc
NAME                                         READY   STATUS    RESTARTS   AGE
pod/kubernetes-quickstart-5df99d7885-6r965   1/1     Running   0          24h

NAME                                    READY   UP-TO-DATE   AVAILABLE   AGE
deployment.apps/kubernetes-quickstart   1/1     1            1           25h

NAME                            TYPE        CLUSTER-IP     EXTERNAL-IP   PORT(S)   AGE
service/kubernetes              ClusterIP   10.96.0.1      <none>        443/TCP   44h
service/kubernetes-quickstart   ClusterIP   10.106.149.0   <none>        80/TCP    25h

NAME                                              CLASS    HOSTS                                  ADDRESS   PORTS   AGE
ingress.networking.k8s.io/kubernetes-quickstart   <none>   prod.svc.url,dev.svc.url,alt.svc.url             80      43h

访问

curl 

curl http://prod.svc.com/prod/hello, 无法获取数据