[CKA] 011. Network

Network concepts and configurations relevant to Kubernetes clusters.

hpyYh avatar
  • hpyYh
  • 2 min read

Network Basic

  • Switch : A PC (192.168.1.10) -> Switch (192.168.1.0) -> B PC (192.168.1.11)
  • Router : Switch (192.168.1.0) <-> Switch (192.168.2.0)
  • Gateway : Role of Router
  • routing table : destination -> gateway
  • ip link : network cards list
  • ip addr : logical address info list
  • ip addr add 192.168.1.10/24 dev eth0 : logical address apply
  • ip route or route : check route info
  • ip route add 192.68.1.0/24 via 192.168,.2.1 : add route rule
  • cat /proc/sys/net/ipv4/ip_forward : route of os setting
    • 0 (disable)
    • 1 (enable)
  • DNS
    • Once upon a time, /etc/hosts is written for name resolution
    • /etc/resolv.conf : all pc use this file for dns server info
    • Over Time DNS server is used for name resolution
      cat /etc/hosts
      nameserver  192.168.1.100
      search      mydomain.com
      
      • if need dns server and hosts order is /etc/nsswitch.conf
    • public dns: www.google.com -> use public dns server like 8.8.8.8
    • dns Server save for using record type
    • nslookup : nslookup google.com 8.8.8.8 -> google’s ip from 8.8.8.8
    • dig : more detailed info than nslookup

Network Namespace

  • Linux kernel support
  • Logical separation of network
  • order
    • ip netns add red : creating network namespace ‘red’
    • ip -n red link : check network namespace ‘red’
    • ip link add veth-red type veth peer name veth-blue : create virtual caple
    • ip link set vth-red netns red : move veth-red to red namespace
    • ip -n red addr add 192.168.15.1 dev veth-red : assign ip to veth-red (dev : device)
    • ip -n red link set veth-red up : start up
  • order 2
    • ip link add v-net-0 type bridge : create bridge
    • ip link set veth-red-br master v-net-0 : connect veth-red to bridge
    • ip addr add 192.168.15.5/24 dev v-net-0 : assign ip to bridge

IP Range check

  • check node info

Proxy Type check

  • check configmap info

Service IP Range check

  • check /etc/kubernetes/apiserver file info

CNI : Container Network Interface

  • kubernetes use cni for pod network
  • cni install path : /etc/cni/net.d

DNS

  • Service : ..svc.<cluster-domain.example>
  • Pod : ..pod.<cluster-domain.example>

CoreDNS : DNS server for kubernetes

  • ConfigMap : CoreDNS config info

Ingress : External access to services in a cluster

Api-Gateway : manage, secure, and scale API traffic


Comment

comments powered by Disqus
hpyYh

Written by : hpyYh

Continue Reading

← Previous Post Postgresql Backup
Next Post → [CKA] 010. Storage