Monica Gangwar
Not just your average Software Developer ...
Not just your average Devops Engineer ...
To save the cluster... I had to become something else... someone else ...
And I became Jugadu Engineer as well ...
Full stack Engineer @
Each component has the tendency to either add latency or block the packet altogether!
Kernel
DNS Resolver
Kube Proxy
CNI
Voila!
Service IP
Pod IP
DNS lookup
Pod IP
Objective : Send packet to serviceB
Latencies in dns lookups
"I don't have any authority over Linux other than this notion that I know what I'm doing."
- Linus Torvalds
- Monica Gangwar
How to debug it
tcpdump port 53
conntrack -S
How to avoid it
# linux
---
apiVersion: extensions/v1beta1
kind: Deployment
spec:
template:
spec:
dnsConfig:
options:
- name: single-request-reopen
# grpc on linux
---
apiVersion: extensions/v1beta1
kind: Deployment
spec:
template:
spec:
containers:
- env:
- name: GRPC_DNS_RESOLVER
value: native
name: sample-grpc-app
dnsConfig:
options:
- name: single-request-reopen
Kernel
DNS Resolver
Kube Proxy
CNI
Voila!
Service IP
Pod IP
DNS lookup
Pod IP
Objective : Resolve serviceB to service IP
Parameters | KubeDns | CoreDns |
---|---|---|
Negative Caching | Absent | Present |
CPU | Single threaded in C | Multi threaded in Go |
Memory | Multiple containers | Single container |
Latency | Better for internal DNS | Better for external DNS |
Avoid latency due to DNS resolver
apiVersion: v1
data:
Corefile: |
.:53 {
log
health
errors
reload
cache 30
prometheus :9153
kubernetes cluster.local 100.64.0.0/13 {
pods verified
resyncperiod 1m
}
autopath @kubernetes
forward . /etc/resolv.conf
}
kind: ConfigMap
metadata:
name: coredns
Kernel
DNS Resolver
Kube Proxy
CNI
Voila!
Service IP
Pod IP
DNS lookup
Pod IP
Objective : Resolve service IP to Pod IP
conntrack -L
ipvsadm -ln
iptables-save
-A KUBE-SERVICES -d 100.65.207.102/32 -p tcp -m tcp --dport 8080 -j KUBE-SVC-ZTQKF64YG2DSI7SY
-A KUBE-SVC-ZTQKF64YG2DSI7SY -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-A7VB3EEHPCZHU76Q
-A KUBE-SVC-ZTQKF64YG2DSI7SY -j KUBE-SEP-KPI6I3B54SPPUXJ2
:KUBE-SEP-A7VB3EEHPCZHU76Q - [0:0]
-A KUBE-SEP-A7VB3EEHPCZHU76Q -s 100.125.192.6/32 -j KUBE-MARK-MASQ
-A KUBE-SEP-A7VB3EEHPCZHU76Q -p tcp -m tcp -j DNAT --to-destination 100.125.192.6:8080
-A KUBE-SVC-ZTQKF64YG2DSI7SY -m statistic --mode random --probability 0.50000000000 -j KUBE-SEP-A7VB3EEHPCZHU76Q
:KUBE-SEP-KPI6I3B54SPPUXJ2 - [0:0]
-A KUBE-SEP-KPI6I3B54SPPUXJ2 -s 100.98.136.0/32 -j KUBE-MARK-MASQ
-A KUBE-SEP-KPI6I3B54SPPUXJ2 -p tcp -m tcp -j DNAT --to-destination 100.98.136.0:8080
-A KUBE-SVC-ZTQKF64YG2DSI7SY -j KUBE-SEP-KPI6I3B54SPPUXJ2
Kernel
DNS Resolver
Kube Proxy
CNI
Voila!
Service IP
Pod IP
DNS lookup
Pod IP
Objective : Reach correct container on correct node using Pod Ip
In depth article here
Logs, logs and logs ...
Wide variety of Add ons available for CNI and each have their own way of implementing networks
Kubernetes is not that complex either
Networking is hard
Networking is fun
Abstracted Networking sucks
Thanks, I'm out!