istio / istio.io

Source for the istio.io site
https://istio.io/
Apache License 2.0
761 stars 1.54k forks source link

steps for determine ingress ip and port does not work for minikube on Mac #11243

Closed binchenX closed 2 years ago

binchenX commented 2 years ago

Following instructions regarding how to get the host and IP for the ingress 1 does not work for in minikube environment (see below) for me.

 export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].nodePort}')
export INGRESS_HOST=$(minikube ip)

It will give you ingress host and port with something like 192.168.59.100:31873 and curl it will

$curl -v  http://192.168.59.100:31873/productpage
*   Trying 192.168.59.100...
* TCP_NODELAY set

However, if I follow the steps listed in the official minikbue doc,

Notably, for IP using the EXTERNAL-IP column, instead of using 'minikube IP'

To find the routable IP, run this command and examine the EXTERNAL-IP column:

kubectl get services balanced
Your deployment is now available at <EXTERNAL-IP>:8080

Noticed that this is the exact same instruction for other platforms as listed in 1.

export INGRESS_HOST=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
export INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="http2")].port}')
export SECURE_INGRESS_PORT=$(kubectl -n istio-system get service istio-ingressgateway -o jsonpath='{.spec.ports[?(@.name=="https")].port}')

And that instruction will give me the result I expect:

➜  ~ curl http://localhost:80/productpage

Not sure if there is something peculiar about my setup or this is a mistake on the doc but seems minikube can use same instructions as "other platforms", at least in my environment..

Minikube environment

tldr: Minikube on Mac, with dockker as the driver

{
    "Name": "minikube",
    "KeepContext": false,
    "EmbedCerts": false,
    "MinikubeISO": "",
    "KicBaseImage": "gcr.io/k8s-minikube/kicbase:v0.0.30@sha256:02c921df998f95e849058af14de7045efc3954d90320967418a0d1f182bbc0b2",
    "Memory": 2942,
    "CPUs": 2,
    "DiskSize": 20000,
    "VMDriver": "",
    "Driver": "docker",
    "HyperkitVpnKitSock": "",
    "HyperkitVSockPorts": [],
    "DockerEnv": null,
    "ContainerVolumeMounts": null,
    "InsecureRegistry": null,
    "RegistryMirror": [],
    "HostOnlyCIDR": "192.168.59.1/24",
    "HypervVirtualSwitch": "",
    "HypervUseExternalSwitch": false,
    "HypervExternalAdapter": "",
    "KVMNetwork": "default",
    "KVMQemuURI": "qemu:///system",
    "KVMGPU": false,
    "KVMHidden": false,
    "KVMNUMACount": 1,
    "DockerOpt": null,
    "DisableDriverMounts": false,
    "NFSShare": [],
    "NFSSharesRoot": "/nfsshares",
    "UUID": "",
    "NoVTXCheck": false,
    "DNSProxy": false,
    "HostDNSResolver": true,
    "HostOnlyNicType": "virtio",
    "NatNicType": "virtio",
    "SSHIPAddress": "",
    "SSHUser": "root",
    "SSHKey": "",
    "SSHPort": 22,
    "KubernetesConfig": {
        "KubernetesVersion": "v1.23.3",
        "ClusterName": "minikube",
        "Namespace": "default",
        "APIServerName": "minikubeCA",
        "APIServerNames": null,
        "APIServerIPs": null,
        "DNSDomain": "cluster.local",
        "ContainerRuntime": "docker",
        "CRISocket": "",
        "NetworkPlugin": "",
        "FeatureGates": "",
        "ServiceCIDR": "10.96.0.0/12",
        "ImageRepository": "",
        "LoadBalancerStartIP": "",
        "LoadBalancerEndIP": "",
        "CustomIngressCert": "",
        "ExtraOptions": [
            {
                "Component": "kubelet",
                "Key": "housekeeping-interval",
                "Value": "5m"
            }
        ],
        "ShouldLoadCachedImages": true,
        "EnableDefaultCNI": false,
        "CNI": "",
        "NodeIP": "",
        "NodePort": 8443,
        "NodeName": ""
    },
    "Nodes": [
        {
            "Name": "",
            "IP": "192.168.49.2",
            "Port": 8443,
            "KubernetesVersion": "v1.23.3",
            "ContainerRuntime": "docker",
            "ControlPlane": true,
            "Worker": true
        }
    ],
    "Addons": {
        "dashboard": true,
        "default-storageclass": true,
        "storage-provisioner": true
    },
    "CustomAddonImages": null,
    "CustomAddonRegistries": null,
    "VerifyComponents": {
        "apiserver": true,
        "system_pods": true
    },
    "StartHostTimeout": 360000000000,
    "ScheduledStop": null,
    "ExposedPorts": [],
    "ListenAddress": "",
    "Network": "",
    "MultiNodeRequested": false,
    "ExtraDisks": 0,
    "CertExpiration": 94608000000000000,
    "Mount": false,
    "MountString": "/Users:/minikube-host",
    "Mount9PVersion": "9p2000.L",
    "MountGID": "docker",
    "MountIP": "",
    "MountMSize": 262144,
    "MountOptions": [],
    "MountPort": 0,
    "MountType": "9p",
    "MountUID": "docker",
    "BinaryMirror": "",
    "DisableOptimizations": false
}
ericvn commented 2 years ago

A few other Minikube related issues: https://github.com/istio/istio.io/issues/9340 and https://github.com/istio/istio.io/issues/8286.

ericvn commented 2 years ago

Running through the scenario: Using the Docker hypervisor driver (VMware and hyper kit have issues (This VM is having trouble accessing https://k8s.gcr.io and istio fails to install as it can't pull the images)

When using mk tunnel: service/istio-ingressgateway LoadBalancer 10.100.218.72 127.0.0.1 15021:31939/TCP,80:30771/TCP,443:30942/TCP,31400:32513/TCP,15443:30881/TCP 9m5s When not: service/istio-ingressgateway LoadBalancer 10.100.218.72 <pending> 15021:31939/TCP,80:30771/TCP,443:30942/TCP,31400:32513/TCP,15443:30881/TCP 12m

If using the tunnel: http://127.0.0.1:80/productpage works. The values are determined using the flow where an external IP is defined which it is.

The old non mk tunnel ip/port does not seem to work.

ericvn commented 2 years ago

I am able to run things with a virtual box VM similarly. It does have a warning about using a more preferred driver.