0

Current setup:

NAME        STATUS   ROLES    AGE     VERSION        INTERNAL-IP   EXTERNAL-IP   OS-IMAGE                       KERNEL-VERSION   CONTAINER-RUNTIME
cl01mtr01   Ready    master   104m    v1.18.2+k3s1   10.1.1.1      <none>        Debian GNU/Linux 10 (buster)   4.19.0-9-amd64   containerd://1.3.3-k3s2
cl01wkr01   Ready    <none>   9m20s   v1.18.2+k3s1   10.1.1.101    <none>        Arch Linux ARM                 5.4.40-1-ARCH    containerd://1.3.3-k3s2

Master installed with:

export INSTALL_K3S_VERSION="v1.18.2+k3s1"
curl -sSLf https://get.k3s.io | sh -s - server \
  --write-kubeconfig-mode 644 \
  --cluster-cidr 172.20.0.0/16 \
  --service-cidr 172.21.0.0/16 \
  --cluster-dns 172.21.0.10 \
  --disable traefik

Worker installed with:

export INSTALL_K3S_VERSION="v1.18.2+k3s1"
curl -sSLf https://get.k3s.io | sh -s - agent \
  --server https://10.1.1.1:6443 \
  --token <token from master>

I also tried with a raspberry pi as master running arch linux and raspbian and a rock pi 64 with armbian.

I tried with k3s versions:

  • v1.17.4+k3s1
  • v1.17.5+k3s1
  • v1.18.2+k3s1

I also tested with docker and the --docker install option in k3s.

The nodes get discovered (as shown above), but I cannot access the service on my worker node(s) (raspberry pi 3 with arch linux arm) via http://10.1.1.1:30001 although, it can be accessed via kubectl exec.

I always get a connection timeout

This site can’t be reached
10.1.1.1 took too long to respond.

When the pod runs on the master node, or if the worker is an amd64 node, it can be accessed via http://10.1.1.1:30001.

This is the resource I try to load and access:

apiVersion: v1
kind: Namespace
metadata:
  name: nginx
---
apiVersion: v1
kind: ConfigMap
metadata:
  name: nginx-default-configmap
  namespace: nginx
data:
  default.conf: |
    server {
        listen      80;
        listen      [::]:80;
        #server_name localhost;

        location / {
            root   /usr/share/nginx/html;
            index  index.html index.htm;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   /usr/share/nginx/html;
        }
    }
---
apiVersion: v1
kind: Service
metadata:
  name: nginx-service
  namespace: nginx
spec:
  ports:
    - name: http
      targetPort: 80
      port: 80
      nodePort: 30001
    - name: https
      targetPort: 443
      port: 443
      nodePort: 30002
  selector:
    app: nginx
  type: NodePort
---
apiVersion: apps/v1
kind: DaemonSet
metadata:
  name: nginx-daemonset
  namespace: nginx
  labels:
    app: nginx
spec:
  selector:
    matchLabels:
      app: nginx
  template:
    metadata:
      labels:
        app: nginx
    spec:
      affinity:
        nodeAffinity:
          requiredDuringSchedulingIgnoredDuringExecution:
            nodeSelectorTerms:
            - matchExpressions:
              - key: node-role.kubernetes.io/master
                operator: NotIn
                values:
                - "true"
      containers:
      - name: nginx
        image: nginx:stable
        imagePullPolicy: Always
        env:
        - name: TZ
          value: "Europe/Brussels"
        ports:
        - name: http
          containerPort: 80
        - name: https
          containerPort: 443
        volumeMounts:
        - name: default-conf
          mountPath: /etc/nginx/conf.d/default.conf
          subPath: default.conf
          readOnly: true
      restartPolicy: Always
      volumes:
      - name: default-conf
        configMap:
          name: nginx-default-configmap

Some extra info:

> kubectl get all -A -o wide
NAMESPACE     NAME                                         READY   STATUS    RESTARTS   AGE    IP           NODE        NOMINATED NODE   READINESS GATES
kube-system   pod/local-path-provisioner-6d59f47c7-d477m   1/1     Running   0          116m   172.20.0.4   cl01mtr01   <none>           <none>
kube-system   pod/metrics-server-7566d596c8-fbb7b          1/1     Running   0          116m   172.20.0.2   cl01mtr01   <none>           <none>
kube-system   pod/coredns-8655855d6-gnbsm                  1/1     Running   0          116m   172.20.0.3   cl01mtr01   <none>           <none>
nginx         pod/nginx-daemonset-l4j7s                    1/1     Running   0          52s    172.20.1.3   cl01wkr01   <none>           <none>

NAMESPACE     NAME                     TYPE        CLUSTER-IP       EXTERNAL-IP   PORT(S)                      AGE    SELECTOR
default       service/kubernetes       ClusterIP   172.21.0.1       <none>        443/TCP                      116m   <none>
kube-system   service/kube-dns         ClusterIP   172.21.0.10      <none>        53/UDP,53/TCP,9153/TCP       116m   k8s-app=kube-dns
kube-system   service/metrics-server   ClusterIP   172.21.152.234   <none>        443/TCP                      116m   k8s-app=metrics-server
nginx         service/nginx-service    NodePort    172.21.14.185    <none>        80:30001/TCP,443:30002/TCP   52s    app=nginx

NAMESPACE   NAME                             DESIRED   CURRENT   READY   UP-TO-DATE   AVAILABLE   NODE SELECTOR   AGE   CONTAINERS   IMAGES         SELECTOR
nginx       daemonset.apps/nginx-daemonset   1         1         1       1            1           <none>          52s   nginx        nginx:stable   app=nginx

NAMESPACE     NAME                                     READY   UP-TO-DATE   AVAILABLE   AGE    CONTAINERS               IMAGES                                   SELECTOR
kube-system   deployment.apps/local-path-provisioner   1/1     1            1           116m   local-path-provisioner   rancher/local-path-provisioner:v0.0.11   app=local-path-provisioner
kube-system   deployment.apps/metrics-server           1/1     1            1           116m   metrics-server           rancher/metrics-server:v0.3.6            k8s-app=metrics-server
kube-system   deployment.apps/coredns                  1/1     1            1           116m   coredns                  rancher/coredns-coredns:1.6.3            k8s-app=kube-dns

NAMESPACE     NAME                                               DESIRED   CURRENT   READY   AGE    CONTAINERS               IMAGES                                   SELECTOR
kube-system   replicaset.apps/local-path-provisioner-6d59f47c7   1         1         1       116m   local-path-provisioner   rancher/local-path-provisioner:v0.0.11   app=local-path-provisioner,pod-template-hash=6d59f47c7
kube-system   replicaset.apps/metrics-server-7566d596c8          1         1         1       116m   metrics-server           rancher/metrics-server:v0.3.6            k8s-app=metrics-server,pod-template-hash=7566d596c8
kube-system   replicaset.apps/coredns-8655855d6                  1         1         1       116m   coredns                  rancher/coredns-coredns:1.6.3            k8s-app=kube-dns,pod-template-hash=8655855d6
Maarten
  • 41
  • 5
  • How did you try to access the service that running worker node? `kubectl exec` or via browser? What's the error you're getting? @Maarten – hariK May 19 '20 at 20:09
  • I updated the question. I get a connection timeout via the browser, but a `kubectl exec` works just fine. – Maarten May 19 '20 at 20:37
  • According to your information. Now nginx pod is running on worker node `cl01wkr01`. Which has the IP address of `10.1.1.101`. So, you should try to access the service via `http://10.1.1.101:30001` instead of `http://10.1.1.1:30001` – hariK May 19 '20 at 20:55
  • When accessing via `http://10.1.1.101:30001` it works. But it's a cluster, I don't want to lookup on what node the pod is running and querying its IP... – Maarten May 20 '20 at 06:03
  • You've to deploy a load balancer on your cluster and create ingress rules with hostname to access your services. – hariK May 20 '20 at 06:34
  • Why would that entire setup work when using `x86_64` machines and for `arm` not? I tested it with traefik enabled and ingress rules and the behaviour is exactly the same. – Maarten May 20 '20 at 10:12

0 Answers0