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

K3s Ingress controller not deployed #133

Closed
myannou opened this issue Jan 19, 2022 · 3 comments · Fixed by #251
Closed

K3s Ingress controller not deployed #133

myannou opened this issue Jan 19, 2022 · 3 comments · Fixed by #251

Comments

@myannou
Copy link

myannou commented Jan 19, 2022

when using colima with kubernets:
colima start --with-kubernetes

a k3s cluster is correctly deployed but without an Ingress controller.
Normally k3s comes with a traefik-ingress-controller.

I found this has been disabled in k3s.go

I wonder why ?

I can deploy myself an Ingress controller but then how to do a port-forwarding of the ingress port ?

@abiosoft
Copy link
Owner

The wide variety of versions and setup for Kubernetes is the main reason for opting for the minimal Kubernetes setup.

For more complex uses cases, there are more feature packed docker-based solutions that will work with colima e.g. minikube (with docker driver), kind and k3d.

I can deploy myself an Ingress controller but then how to do a port-forwarding of the ingress port ?

This should not be a problem as port forwarding is automatic.

@myannou
Copy link
Author

myannou commented Jan 19, 2022

I don't consider ingress usage in k8s as a complex use case but more a basic & standard usecase of kubernetes.
but, I understand your point
I didn't know how port forwarding worked, so thanks for the clarification
So I will now see how to deploy k3d in colima
thanks

@myannou
Copy link
Author

myannou commented Feb 16, 2022

As it could help others, here is what I did to automatically deploy an ingress:
in the ~/.lima/_config/override.yaml file I added:

provision:
- mode: system
  script: |
    #!/bin/bash
    mkdir -p /var/lib/rancher/k3s/server/manifests
    cat > /var/lib/rancher/k3s/server/manifests/helm-ingress-nginx.yaml << EOF
    apiVersion: helm.cattle.io/v1
    kind: HelmChart
    metadata:
      name: ingress-controller-nginx
      namespace: kube-system
    spec:
      repo: https://kubernetes.github.io/ingress-nginx
      chart: ingress-nginx
      version: 4.0.17
      targetNamespace: kube-system
      valuesContent: |-
        controller:
          service:
            ports:
              http: 8080
              https: 8043
          watchIngressWithoutClass: true
          ingressClassResource:
            default: true
    EOF

and that's all!

Each time you will create a colima vm: colima start --with-kubernetes --runtime containerd
this will also deploy a nginx ingress in K3S
It relies on 2 features of k3s:

  • ‘Auto-Deploying Manifests’ A practical feature of k3s: Any file found in /var/lib/rancher/k3s/server/manifests will automatically be deployed to Kubernetes in a manner similar to kubectl apply
  • Helm charts Operator: K3s includes a Helm Controller that manages Helm charts using a HelmChart Custom Resource Definition (CRD)

And so the ingress port 8080/8043 will be also "port forwarded" on your host

Hope it can help others

@abiosoft abiosoft mentioned this issue Apr 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants