kubernetes

rc           replication controller
pod       pause
proxy
service
labels

master
node

etcd              存储

kube-apiserver
kube-scheduler
kube-controller-manager

kubelet
kube-proxy
docker


yum -y install kubernetes-1.2.0 docker-1.8.2 docker-selinux-1.8.2

lvs fullnat
nginx

docker logs
fluentd
glusterfs

hostPath
emptyDir

cAdvisor
heapster+influxdb+grafana
flannel  host-gw

calico      网络解决方案
fluentd     日志收集
nginx转发,使用Python实现rolling-update,并更新nginx配置
heapster    监控
calico    
环境    
kubernetes:    1.2.0
docker:        1.8.2
centos:        7.2.1503
calico:        0.20.0
Master安装    
yum -y install kubernetes-1.2.0
wget https://github.com/projectcalico/calico-containers/releases/download/v0.20.0/calicoctl
chmod +x calicoctl
mv calicoctl /usr/bin
docker pull calico/node:v0.20.0 
cat > /etc/network-environment << EOF
# This host's IPv4 address (the source IP address used to reach other nodes
# in the Kubernetes cluster).
DEFAULT_IPV4=<KUBERNETES_MASTER> 
# IP and port of etcd instance used by Calico
ETCD_AUTHORITY=<KUBERNETES_MASTER>:6666
EOF
wget -N -P /etc/systemd https://raw.githubusercontent.com/projectcalico/calico-cni/k8s-1.1-docs/samples/kub
ernetes/common/calico-node.service
systemctl enable /etc/systemd/calico-node.service
systemctl start calico-node.service
Node安装
wget https://github.com/projectcalico/calico-containers/releases/download/v0.20.0/calicoctl
chmod +x calicoctl
mv calicoctl /usr/bin
docker pull calico/node:v0.20.0
cat > /etc/network-environment << EOF
# This host's IPv4 address (the source IP address used to reach other nodes
# in the Kubernetes cluster).
DEFAULT_IPV4=<KUBERNETES_MASTER> 
# IP and port of etcd instance used by Calico
ETCD_AUTHORITY=<KUBERNETES_MASTER>:6666 
EOF
wget -N -P /etc/systemd https://raw.githubusercontent.com/projectcalico/calico-cni/k8s-1.1-docs/samples/kubernetes/co
mmon/calico-node.service
systemctl enable /etc/systemd/calico-node.service
systemctl start calico-node.service
mkdir -p /opt/cni/bin/
wget -N -P /opt/cni/bin/ https://github.com/projectcalico/calico-cni/releases/download/v1.0.0/calico
wget -N -P /opt/cni/bin/ https://github.com/projectcalico/calico-cni/releases/download/v1.0.0/calico-ipam
chmod +x /opt/cni/bin/calico /opt/cni/bin/calico-ipam
# Make the directory structure.
mkdir -p /etc/cni/net.d 
# Make the network configuration file 
cat >/etc/cni/net.d/10-calico.conf <<EOF
{
    "name": "calico-k8s-network",
    "type": "calico", 
    "etcd_authority": "<KUBERNETES_MASTER>:6666",
    "log_level": "info",
    "ipam": { 
       "type": "calico-ipam"
    } 
}
EOF
配置kubelet
vim /etc/kubernetes/kubelet
# Add your own!
KUBELET_ARGS="--network-plugin=cni --network-plugin-dir=/etc/cni/net.d"
calico配置访问外网 
[root@vm-docker-c7-80 ~]# calicoctl pool show
 +----------------+---------+
  |   IPv4 CIDR    | Options |
 +----------------+---------+
  | 192.168.0.0/16 |         |
 +----------------+---------+
 +--------------------------+---------+
  |        IPv6 CIDR         | Options |
 +--------------------------+---------+
  | fd80:24e2:f998:72d6::/64 |         |
 +--------------------------+---------+
 [root@vm-docker-c7-80 ~]# calicoctl pool add 192.168.0.0/16 --nat-outgoing
 [root@vm-docker-c7-80 ~]# calicoctl pool show
  +----------------+--------------+
   |   IPv4 CIDR    |   Options    |
  +----------------+--------------+
   | 192.168.0.0/16 | nat-outgoing |
  +----------------+--------------+
  +--------------------------+---------+
   |        IPv6 CIDR         | Options |
  +--------------------------+---------+
   | fd80:24e2:f998:72d6::/64 |         |
  +--------------------------+---------+
[root@vm-docker-c7-80 ~]# kubectl get pods
NAME      READY   STATUS    RESTARTSAGE
 test1     1/1       Running   0          3h
test2     1/1       Running   0          3h
[root@vm-docker-c7-80 ~]# kubectl exec -it test1 ping www.baidu.com
 PING www.baidu.com (61.135.169.125): 56 data bytes
64 bytes from 61.135.169.125: seq=0 ttl=54 time=2.535 ms
 64 bytes from 61.135.169.125: seq=1 ttl=54 time=2.309 ms
 ^C
 --- www.baidu.com ping statistics ---
2 packets transmitted, 2 packets received, 0% packet loss
 round-trip min/avg/max = 2.309/2.422/2.535 ms

flannel 
环境: 
kubernetes      v1.2.0
flannel         0.5.3
centos          7.1
kernel          4.2.3
docker          1.8.2
安装:    
yum -y install flanneld etcd kubernetes
vim /etc/etcd/etcd.conf
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
ETCD_ADVERTISE_CLIENT_URLS="http://0.0.0.0:2379" 
vim /etc/sysconfig/flanneld
FLANNEL_ETCD="http://127.0.0.1:2379"
FLANNEL_ETCD_KEY="/flannel/network"
FLANNEL_OPTIONS="-iface=br1"

设置flannel所提供的网段,并写入etcd:
etcdctl set /flanneld/network/config '{"Network": "10.0.0.0/22", "Backend": {"Type": “host-gw”}}’

results matching ""

    No results matching ""