solidnerd / terraform-k8s-hcloud

A simple project to spin your k8s cluster with terraform, kubeadm on hcloud
MIT License
89 stars 37 forks source link

ingress examples dont work .... #31

Open yoplait opened 2 years ago

yoplait commented 2 years ago

Hi there I tried to follow the examples provided from the web: https://alexslubsky.medium.com/setup-highly-available-kubernetus-cluster-with-hetzner-cloud-and-terraform-941a9e25ddf6

KUBECONFIG=secrets/admin.conf helm install -n kube-system tmp-ingress ingress-nginx/ingress-nginx -f demo-ingress.yml
KUBECONFIG=secrets/admin.conf kubectl apply -f demo-app.yml

That is generating two services, as load balancer:

| => KUBECONFIG=secrets/admin.conf helm install -n kube-system tmp-ingress ingress-nginx/ingress-nginx -f demo-ingress.yml

NAME: tmp-ingress
LAST DEPLOYED: Thu Dec 16 02:50:32 2021
NAMESPACE: kube-system
STATUS: deployed
REVISION: 1
TEST SUITE: None
NOTES:
The ingress-nginx controller has been installed.
It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status by running 'kubectl --namespace kube-system get services -o wide -w tmp-ingress-ingress-nginx-controller'

An example Ingress that makes use of the controller:
  apiVersion: networking.k8s.io/v1
  kind: Ingress
  metadata:
    name: example
    namespace: foo
  spec:
    ingressClassName: nginx
    rules:
      - host: www.example.com
        http:
          paths:
            - backend:
                service:
                  name: exampleService
                  port:
                    number: 80
              path: /
    # This section is only required if TLS is to be enabled for the Ingress
    tls:
      - hosts:
        - www.example.com
        secretName: example-tls

If TLS is enabled for the Ingress, a Secret containing the certificate and key must also be provided:

  apiVersion: v1
  kind: Secret
  metadata:
    name: example-tls
    namespace: foo
  data:
    tls.crt: <base64 encoded cert>
    tls.key: <base64 encoded key>
  type: kubernetes.io/tls

and then the app

| ~/Documents/code/ubloquity/wireguard/rancher @ jperez-mbp (jperez)
| => KUBECONFIG=secrets/admin.conf kubectl apply -f demo-app.yml
service/hello-kubernetes-custom unchanged
deployment.apps/hello-kubernetes-custom unchanged
ingress.networking.k8s.io/hello-kubernetes-ingress created
ingress.networking.k8s.io/hello-kubernetes-ingress-world created

I can see the lb in the hetzner UI but no curl on that:

| => KUBECONFIG=secrets/admin.conf kubectl get services --all-namespaces=true
NAMESPACE     NAME                                             TYPE           CLUSTER-IP       EXTERNAL-IP                                    PORT(S)                      AGE
default       hello-kubernetes-custom                          ClusterIP      10.100.61.10     <none>                                         80/TCP                       63s
default       kubernetes                                       ClusterIP      10.96.0.1        <none>                                         443/TCP                      73m
kube-system   cilium-agent                                     ClusterIP      None             <none>                                         9095/TCP                     71m
kube-system   hcloud-csi-driver-controller-metrics             ClusterIP      10.105.159.126   <none>                                         9189/TCP                     71m
kube-system   hcloud-csi-driver-node-metrics                   ClusterIP      10.109.99.41     <none>                                         9189/TCP                     71m
kube-system   kube-dns                                         ClusterIP      10.96.0.10       <none>                                         53/UDP,53/TCP,9153/TCP       73m
kube-system   tmp-ingress-ingress-nginx-controller             LoadBalancer   10.102.124.233   10.88.0.4,2a01:4f9:c01e:447::1,95.217.171.73   80:32760/TCP,443:31786/TCP   71s
kube-system   tmp-ingress-ingress-nginx-controller-admission   ClusterIP      10.100.43.236    <none>                                         443/TCP                      71s

and curl:

| ~/Documents/code/ubloquity/wireguard/rancher @ jperez-mbp (jperez)
| => curl -I http://95.217.171.73/testpath

HTTP/1.1 404 Not Found
Date: Thu, 16 Dec 2021 01:52:15 GMT
Content-Type: text/html
Content-Length: 146
Connection: keep-alive