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

How to create a valid URL when using kubernetes in the backend? #3463

Closed
dharmit opened this issue Jul 1, 2020 · 14 comments · Fixed by #3858
Closed

How to create a valid URL when using kubernetes in the backend? #3463

dharmit opened this issue Jul 1, 2020 · 14 comments · Fixed by #3858
Assignees
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. area/kubernetes Issues or PRs related to Kubernetes v2 Issue or PR that applies to the v2 of odo

Comments

@dharmit
Copy link
Member

dharmit commented Jul 1, 2020

/kind documentation

What mistake did you find / what is missing in the documentation?

In the CLI documentation, I don't see a way to create a URL that assumes kubernetes/minikube as the backend.

$ odo url create -h
Create a URL for a component. The created URL can be used to access the specified component from outside the cluster.

Usage:
  odo url create [url name] [flags]

Examples:
  # Create a URL with a specific host by automatically detecting the port used by the component (using CRC as an exampple)
  odo url create example  --host apps-crc.testing
  
  # Create a URL with a specific name and host (using CRC as an example)
  odo url create example --host apps-crc.testing
  
  # Create a URL for the current component with a specific port and host (using CRC as an example)
  odo url create --port 8080 --host apps-crc.testing
  
  # Create a URL of ingress kind for the current component with a host (using CRC as an example)
  odo url create --host apps-crc.testing --ingress
  
  # Create a secure URL for the current component with a specific host (using CRC as an example)
  odo url create --host apps-crc.testing --secure

What is the relevance of it?

It is relevant because that's the first source of documentation for odo CLI user and it contains only CRC related examples.


NOTE:

This issue is opened to add missing CLI documentation. The same problem may or may not be existent in the web based docs but that's not what this issue is referring to.

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

I tried below steps to create a URL on k8s but it didn't work for me:

$  minikube ip
192.168.39.95

$ odo url create --host `minikube ip`.nip.io
I0701 11:31:31.125449    9688 cert_rotation.go:137] Starting client certificate rotation controller
 ✓  URL node-todo-8080 created for component: node-todo

To apply the URL configuration changes, please use `odo push`

$ odo push
I0701 11:31:51.092827    9760 cert_rotation.go:137] Starting client certificate rotation controller

Validation
 ✓  Validating the devfile [16684ns]

Creating Kubernetes resources for component node-todo
 ✓  Waiting for component to start [2ms]

Applying URL changes
 ✓  URL node-todo-8080: http://node-todo-8080.192.168.39.95.nip.io created

Syncing to component node-todo
 ✓  Checking file changes for pushing [816133ns]
 ✓  No file changes detected, skipping build. Use the '-f' flag to force the build.

Pushing devfile component node-todo
 ✓  Changes successfully pushed to component

But I can't access the app on http://node-todo-8080.192.168.39.95.nip.io. What am I doing wrong? 🤔

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

/area url
/area devfile

ping @mik-dass @yangcao77

@openshift-ci-robot openshift-ci-robot added area/url area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. labels Jul 1, 2020
@dharmit dharmit added the area/kubernetes Issues or PRs related to Kubernetes label Jul 1, 2020
@kadel
Copy link
Member

kadel commented Jul 1, 2020

But I can't access the app on http://node-todo-8080.192.168.39.95.nip.io. What am I doing wrong? 🤔

can you check how your Ingress looks? kubectl get ing -o yaml ?

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

$ kubectl get ing
NAME             CLASS    HOSTS                                 ADDRESS   PORTS   AGE
node-todo-8080   <none>   node-todo-8080.192.168.39.95.nip.io             80      4h11m

And here's the yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  creationTimestamp: "2020-07-01T06:01:51Z"
  generation: 1
  labels:
    app: ""
    app.kubernetes.io/instance: node-todo
    app.kubernetes.io/managed-by: odo
    app.kubernetes.io/managed-by-version: v1.2.3
    app.kubernetes.io/part-of: ""
    odo.openshift.io/url-name: node-todo-8080
  managedFields:
  - apiVersion: extensions/v1beta1
    fieldsType: FieldsV1
    fieldsV1:
      f:metadata:
        f:labels:
          .: {}
          f:app: {}
          f:app.kubernetes.io/instance: {}
          f:app.kubernetes.io/managed-by: {}
          f:app.kubernetes.io/managed-by-version: {}
          f:app.kubernetes.io/part-of: {}
          f:odo.openshift.io/url-name: {}
        f:ownerReferences:
          .: {}
          k:{"uid":"fb19e14c-98f7-4dc9-9918-8bdfa009bdbd"}:
            .: {}
            f:apiVersion: {}
            f:kind: {}
            f:name: {}
            f:uid: {}
      f:spec:
        f:rules: {}
    manager: odo
    operation: Update
    time: "2020-07-01T06:01:51Z"
  name: node-todo-8080
  namespace: default
  ownerReferences:
  - apiVersion: apps/v1
    kind: Deployment
    name: node-todo
    uid: fb19e14c-98f7-4dc9-9918-8bdfa009bdbd
  resourceVersion: "63873"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/node-todo-8080
  uid: 646c6bfd-5f93-4bef-8b3d-1ab132a6e1aa
spec:
  rules:
  - host: node-todo-8080.192.168.39.95.nip.io
    http:
      paths:
      - backend:
          serviceName: node-todo
          servicePort: 8080
        path: /
        pathType: ImplementationSpecific
status:
  loadBalancer: {}

@kadel
Copy link
Member

kadel commented Jul 1, 2020

What type of Ingress controller are you using?

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

What type of Ingress controller are you using?

I don't know what you're asking about. I'm using minikube. Haven't touched anything since doing minikube start.

$  minikube version
minikube version: v1.10.1
commit: 63ab801ac27e5742ae442ce36dff7877dcccb278

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

$ kubectl get ing
NAME             CLASS    HOSTS                                 ADDRESS   PORTS   AGE
node-todo-8080   <none>   node-todo-8080.192.168.39.95.nip.io             80      4h11m

Why do we see 80 in the PORTS field above? Is that OK? The app and devfile is all about 8080

@mik-dass
Copy link
Contributor

mik-dass commented Jul 1, 2020

@dharmit I have been trying to figure this out since a long time but have been unsuccessfully so far.

@kadel
Copy link
Member

kadel commented Jul 1, 2020

I don't know what you're asking about. I'm using minikube. Haven't touched anything since doing minikube start.

that might be a problem ;-)
What is the exact error that you are getting? Is it connection refused? Then you probably don't have ingress controller enable.
see https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

Why do we see 80 in the PORTS field above? Is that OK? The app and devfile is all about 8080

That is the port for the ingress controller, which is usually 80 or 443 in the case of https.

<ingress host>:80 points to <component Service>:8080

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

Then you probably don't have ingress controller enable.
see https://kubernetes.io/docs/tasks/access-application-cluster/ingress-minikube/

I see. One of the downsides of using OCP where Routes work OOTB. Enabling the ingres addon did the trick! URL loads fine.

@dharmit
Copy link
Member Author

dharmit commented Jul 1, 2020

However, I still think that some kind of CLI docs are needed that a k8s user might find helpful. A separate small section indicating how it can be done for minikube along with this link that explains how to enable ingres addon.

WDYT @mik-dass @kadel @yangcao77 ?

@kadel
Copy link
Member

kadel commented Jul 1, 2020

However, I still think that some kind of CLI docs are needed that a k8s user might find helpful. A separate small section indicating how it can be done for minikube along with this link that explains how to enable ingres addon.

Yes, this should be documented somewhere, but I'm not sure that the CLI help is a good place for this, odo documentation might be a better place

@girishramnani
Copy link
Contributor

co-related to this #3771

@girishramnani girishramnani assigned cdrage and unassigned amitkrout Aug 24, 2020
cdrage added a commit to cdrage/odo that referenced this issue Aug 27, 2020
**What type of PR is this?**
> Uncomment only one ` /kind` line, and delete the rest.
> For example, `> /kind bug` would simply become: `/kind bug`

/kind cleanup
/kind documentation

**What does does this PR do / why we need it**:

Updates the `--help` in the following way:
 - Changes the `odo create --help` usage to a 1-sentence summary similar
 to every other command
 - Updates our documentation to remove any mention of crc for something
 more neutral (example.com) similar to kubectl / kubernetes
 documentation, for example: https://kubernetes.io/docs/concepts/services-networking/ingress/

**Which issue(s) this PR fixes**:

Fixes redhat-developer#3463

**PR acceptance criteria**:

- [X] Documentation

- [X] I have read the [test guidelines](https://github.com/openshift/odo/blob/master/docs/dev/test-architecture.adoc)

**How to test changes / Special notes to the reviewer**:

`odo create --help`

and

`odo url create --help`

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
@cdrage
Copy link
Member

cdrage commented Aug 28, 2020

#3858 will close this issue!

openshift-merge-robot pushed a commit that referenced this issue Aug 28, 2020
* init

* Update the help usage for odo create and odo url create

**What type of PR is this?**
> Uncomment only one ` /kind` line, and delete the rest.
> For example, `> /kind bug` would simply become: `/kind bug`

/kind cleanup
/kind documentation

**What does does this PR do / why we need it**:

Updates the `--help` in the following way:
 - Changes the `odo create --help` usage to a 1-sentence summary similar
 to every other command
 - Updates our documentation to remove any mention of crc for something
 more neutral (example.com) similar to kubectl / kubernetes
 documentation, for example: https://kubernetes.io/docs/concepts/services-networking/ingress/

**Which issue(s) this PR fixes**:

Fixes #3463

**PR acceptance criteria**:

- [X] Documentation

- [X] I have read the [test guidelines](https://github.com/openshift/odo/blob/master/docs/dev/test-architecture.adoc)

**How to test changes / Special notes to the reviewer**:

`odo create --help`

and

`odo url create --help`

Signed-off-by: Charlie Drage <charlie@charliedrage.com>
@rm3l rm3l added the v2 Issue or PR that applies to the v2 of odo label Jun 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/devfile-spec Issues or PRs related to the Devfile specification and how odo handles and interprets it. area/kubernetes Issues or PRs related to Kubernetes v2 Issue or PR that applies to the v2 of odo
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

9 participants