Kubernetes cluster name 지정 생성

kubernetes 최초 생성시 추가 옵션 없이 kubeadm init를 실행하면 기본 cluster name인 kubernetes로 cluster name이 지정됩니다.

kubectl config rename-context로 표시되는 context name 수정이 가능 하지만 최초 생성시부터 원하는 cluster name으로 생성이 되도록 하는 방안을 확인해보겠습니다.

# cluster-config.yaml 생성
# criSocket 옵션 지정이 필요해서 InitConfiguration이 추가 되었습니다. 불필요시 ClusterConfiguration만 선언하면 됩니다.
cat << EOF > cluster-config.yaml
apiVersion: kubeadm.k8s.io/v1beta3
kind: InitConfiguration
nodeRegistration:
  criSocket: /var/run/cri-dockerd.sock
---
apiVersion: kubeadm.k8s.io/v1beta3
kind: ClusterConfiguration
clusterName: my-cluster
kubernetesVersion: stable
controlPlaneEndpoint: "k8s-master-01:6443"
networking:
  podSubnet: "10.244.0.0/16"
EOF

$ sudo kubeadm init --config=cluster-config.yaml

$ kubectl config get-clusters
NAME
my-cluster

Mikrotik router & Cisco L2 Switch Trunking

Scenario

Mikrotik router 와 Cisco L2 스위치 이기종간에 회선 이중화(bonding, etherchannel) 후 두 장비 모두 vlan 100(192.168.100.0/24), vlan 200(192.168.200.0/24)의 통신이 가능하도록 구성

# Mikrotik router side
# bridge 생성
/interface bridge
add name=bridge-lan vlan-filtering=yes

# vlan 생성 및 bridge 할당
/interface vlan
add interface=bridge-lan name=vlan100 vlan-id=100
add interface=bridge-lan name=vlan200 vlan-id=200

# bonding 생성(ether2, ether3 포트 대상)
/interface bonding
add mode=802.3ad name=bonding1 slaves=ether2,ether3 transmit-hash-policy=\
    layer-2-and-3

# trunk 처리, bridge-lan에 포함된 port 중 trunk 대상 아닌 경우 untagged port 처리
/interface bridge port
add bridge=bridge-lan frame-types=admit-only-vlan-tagged interface=bonding1
add bridge=bridge-lan tagged=bonding1,bridge-lan untagged=\
    ether4,ether5,ether6 vlan-ids=100,200

# vlan IP 및 대역 할당
/ip address
add address=192.168.100.1/24 interface=vlan100 network=192.168.100.0
add address=192.168.200.1/24 interface=vlan200 network=192.168.200.0
# Cisco L2 switch side

configure terminal

# vlan IP 및 대역 할당
interface Vlan100
 ip address 192.168.100.2 255.255.255.0
interface Vlan200
 ip address 192.168.200.2 255.255.255.0

# etherchannel 구성(GigabitEthernet0/1, GigabitEthernet0/2 포트 대상)
interface range GigabitEthernet0/1-2
 channel-protocol lacp
 channel-group 1 mode active

# 생성된 etherchannel에 trunk 모드 및 trunking할 vlan 적용
interface Port-channel1
 switchport trunk allowed vlan 100,200
 switchport mode trunk

end
write