安装配置
1 设置 ip 和主机名
/etc/hosts
2 开启路由转发
net.ipv4.ip_forward=1
3 配置 yum 源
RHEL7-extras.iso
4 配置私有仓库 registry [repo]
yum install docker-distribution
管理镜像使用 docker
yum install docker
/etc/sysconfig/docker
上传镜像
centos.tar
kubernetes-dashboard.tar
pod-infrastructure.tar
验证
curl http://192.168.1.10:5000/v2/_catalog
5 配置 kubernets - master
package:
etcd
kubernetes-master
kubernetes-client
service:
kube-apiserver
kube-controller-manager
kube-scheduler
etcd
conf:
/etc/etcd/etcd.conf
6: ETCD_LISTEN_CLIENT_URLS="http://192.168.1.10:2379"
/etc/kubernetes/config
22: KUBE_MASTER="--master=http://192.168.1.10:8080"
/etc/kubernetes/apiserver
8: KUBE_API_ADDRESS="--insecure-bind-address=0.0.0.0"
17: KUBE_ETCD_SERVERS="--etcd-servers=http://192.168.1.10:2379"
23: 删除 ServiceAccount 参数
/etc/kubernetes/controller-manager
/etc/kubernetes/scheduler
验证
kubectl get cs
kubectl get csr
kubectl get node
6 配置 kubernets - minion
package:
kubernetes-node
docker
service:
kubelet
kube-proxy
docker
conf:
/etc/sysconfig/docker
4: 添加参数 --insecure-registry=192.168.1.10:5000 --add-registry 192.168.1.10:5000
/etc/kubernetes/config
22: KUBE_MASTER="--master=http://192.168.1.10:8080"
/etc/kubernetes/kubelet
5: KUBELET_ADDRESS="--address=0.0.0.0"
11: KUBELET_HOSTNAME="--hostname-override=本机名称"
14: 添加 --kubeconfig=/etc/kubernetes/kubelet.kubeconfig
--pod-infra-container-image=pod-infrastructure:latest
/etc/kubernetes/kubelet.kubeconfig
apiVersion: v1
kind: Config
clusters:
- cluster:
server: http://192.168.1.10:8080 ###Master的IP,即自身IP
name: local
contexts:
- context:
cluster: local
name: local
current-context: local
7 网络
master:
/etc/etcd/etcd.conf
ETCD_LISTEN_CLIENT_URLS="http://0.0.0.0:2379"
etcdctl mk /atomic.io/network/config '{"Network": "10.254.0.0/16", "Backend": {"Type": "vxlan"}}'
minion:
package: flannel
/etc/sysconfig/flanneld
FLANNEL_ETCD_ENDPOINTS="http://192.168.1.10:2379"
systemctl restart flanneld docker
8 创建容器,测试
kubectl create -f baseos.yaml
测试
kubectl get pod -o wide
kubectl exec -it test-os-3826630470-jc5j4 -- /bin/bash
kubectl create -f kube-dashboard.yaml
网友评论