question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Microk8s network implementation is faulted. SNAT issue.

See original GitHub issue

Default installation of Microk8s fails test from “Kubernetes tutorial” described here: https://kubernetes.io/docs/tutorials/services/source-ip/

Full output of test below:

px2@sm3:~$ kubectl config set-context --current --namespace=test
Context "microk8s" modified.
px2@sm3:~$ kubectl create deployment source-ip-app --image=k8s.gcr.io/echoserver:1.4

deployment.apps/source-ip-app created
px2@sm3:~$ 
px2@sm3:~$ kubectl expose deployment source-ip-app --name=clusterip --port=80 --target-port=8080
service/clusterip exposed
px2@sm3:~$ kubectl run busybox -it --image=busybox --restart=Never --rm^C
px2@sm3:~$ kubectl get svc
NAME        TYPE        CLUSTER-IP      EXTERNAL-IP   PORT(S)   AGE
clusterip   ClusterIP   10.152.183.84   <none>        80/TCP    17s
px2@sm3:~$ kubectl run busybox -it --image=busybox --restart=Never --rm
If you don't see a command prompt, try pressing enter.
/ # ip a 
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
3: eth0@if7: <BROADCAST,MULTICAST,UP,LOWER_UP,M-DOWN> mtu 1450 qdisc noqueue 
    link/ether 06:e8:ba:a1:40:d9 brd ff:ff:ff:ff:ff:ff
    inet 10.1.95.3/24 scope global eth0
       valid_lft forever preferred_lft forever
/ # wget -qO - 10.152.183.84
CLIENT VALUES:
client_address=10.1.95.1
command=GET
real path=/
query=nil
request_version=1.1
request_uri=http://10.152.183.84:8080/

SERVER VALUES:
server_version=nginx: 1.10.0 - lua: 10001

HEADERS RECEIVED:
connection=close
host=10.152.183.84
user-agent=Wget
BODY:
-no body in request-/ # 

IP address expected to be presented is busybox pod IP address - 10.1.95.3 IP address presented as source reach out service - 10.1.95.1

This means that packets are being SNATed. A side effect of this bug is inability of using revDNS inside cluster.

Inspection report attached. inspection-report-20200424_164356.tar.gz

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
peix2commented, Apr 28, 2020
0reactions
peix2commented, May 13, 2020

Tested on 2 node deployment where server and client pods are on different nodes and all works as it should. Problem solved. Again, thanks @ktsakalozos for taking care of it.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Microk8s network implementation is faulted. SNAT issue. #1139
Default installation of Microk8s fails test from "Kubernetes tutorial" described here: ...
Read more >
Troubleshooting - MicroK8s
You may experience the API server being slow, crashing or forming an unstable multi node cluster. Such problems are often traced to low...
Read more >
microk8s Kubernetes Service connection refused
It's due to you are using the ClusterIP which is only accessible internally from CLuster. Here you require the Nginx ingress controller to ......
Read more >
Trouble with DNS resolution on and Microk8s cluster
I have posted a community wiki answer for better visibility. As Thagor has mentioned in the comment, problem is resolved and was related...
Read more >
Using a non-default interface on a cluster node - microk8s
Failed to create pod sandbox: rpc error: code = Unknown desc = failed to ... cluster multus # Multus CNI enables attaching multiple...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found