pulumi / docs

All things Pulumi docs!
https://pulumi.com
Apache License 2.0
127 stars 222 forks source link

Getting Started guide for K8s incorrectly states minikube doesn't support LoadBalancer #11582

Open biasedbit opened 11 months ago

biasedbit commented 11 months ago

The Pulumi & Kubernetes guide can be updated to remove the conditional service logic for minikube. I got through the example using minikube with isMinikube set to false.

Steps to reproduce:

  1. In a separate terminal, run minikube tunnel (required for LoadBalancer to obtain IP 127.0.0.1)

  2. Follow all instructions with isMinikube set to false

  3. Modify frontend service external port to 8080:

    -- "ports": [{ "port": 80, "target_port": 80, "protocol": "TCP" }],
    ++ "ports": [{ "port": 8080, "target_port": 80, "protocol": "TCP" }],
  4. Run pulumi up

     Type                              Name               Status            
     +   pulumi:pulumi:Stack               pulumi-test-local  created (13s)     
     +   ├─ kubernetes:apps/v1:Deployment  nginx              created (2s)      
     +   └─ kubernetes:core/v1:Service     nginx              created (10s)     
    
    Outputs:
        ip: "127.0.0.1"
    
    Resources:
        + 3 created
  5. Use curl to validate setup:

    ❯ curl -I 127.0.0.1:8080
    HTTP/1.1 200 OK
    Server: nginx/1.25.2
    ...

Notes:

Env details

❯ uname -orm
Darwin 23.0.0 arm64

❯ minikube version
minikube version: v1.31.2
commit: fd7ecd9c4599bef9f04c0986c4a0187f98a4396e

❯ pulumi version
v3.88.0
Rajakavitha1 commented 11 months ago

Hi @biasedbit !!! I tried the instructions that you detailed and yes, it does work indeed. I also checked: https://minikube.sigs.k8s.io/docs/handbook/accessing/#loadbalancer-access.

However, the changes that I noticed in the step was that minikube tunnel does not prompt for any password. And curl "http://localhost:8080" does not work unless it is port forwarded. pulumiminikube.txt kubernetesservices.txt testingthepulumistack.txt

A better approach to documentation update would be to remove the condition service logic isMinikube in all the code examples and mention about using minikube tunnel . Also: I noticed something else too. In the getting started there are no instructions to deploy an app. We are only providing instructions to check if the service is deployed and if we used YAML the isMinikube config need not be set. The deployment goes through. Here's the terminal output of the same. yamltestwithoutisMinikube.txt

@ringods and @desteves please let me know your thought on this approach to documentation and I am more than happy to submit a PR with the changes.

Rajakavitha1 commented 11 months ago

Just submitted a PR with changes for Python and YAML https://github.com/pulumi/pulumi-hugo/pull/3521