kubernetes部署

安装配置ss
yum -y install epel-release
 
yum -y install python-pip
 
pip install --upgrade pip pip install ***
 
 
 
vim /etc/***.json
{
"server":"1.1.1.1",
"server_port":8388,
"local_address": "127.0.0.1",
"local_port":1080,
"password":"password",
"timeout":300,
"method":"aes-256-cfb",
"fast_open": false,
"workers": 1
}
 
配置自启动
vim /etc/systemd/system/***.service
内容如下:
 
[Unit] Description=*** [Service] TimeoutStartSec=0 ExecStart=/usr/bin/sslocal -c /etc/***.json [Install] WantedBy=multi-user.target
启动服务
$ systemctl enable *** $ systemctl start ***
查看状态
systemctl status *** -l
 
privoxy安装配置
 
yum -y install epel-release
yum install privoxy -y
vi /etc/privoxy/config :783: 找到 783行,去掉前面的注释符号,端口可以随便改 listen-address 127.0.0.1:8118 :1336: 找到 1336行,去掉前面的注释符号,后面的1080端口要对应ss服务里面的配置,要一致 forward-socks5t / 127.0.0.1:1080
 
systemctl enable privoxy
systemctl start privoxy
 
测试
export http_proxy=http://127.0.0.1:8118
curl www.google.com
 
 
docker配置代理(proxy,cgroupdriver)
centos 7 安装docker 1.12
 
yum -y remove docker docker-common container-selinux
yum -y remove docker-selinux
yum install -y yum-utils
yum-config-manager \
--add-repo \
yum-config-manager --disable docker-testing
yum makecache fast
 
yum list docker-engine.x86_64 --showduplicates |sort -r
yum install -y docker-engine-1.12.6-1.el7.centos
 
 
systemctl enable docker
systemctl start docker
 
 
mkdir /etc/systemd/system/docker.service.d
touch /etc/systemd/system/docker.service.d/http-proxy.conf
vim /etc/systemd/system/docker.service.d/http-proxy.conf
内容如下
[Service]
Environment="HTTP_PROXY=http://127.0.0.1:8118/"
“HTTPS_PROXY=http://127.0.0.1:8118/”
"NO_PROXY=localhost,127.0.0.1,10.64.0.0/16"
 
 
vim /etc/docker/daemon.json
添加
{
"exec-opts": ["native.cgroupdriver=systemd"]
}
 
 
重新reload 重启docker
systemctl daemon-reload
systemctl restart docker
检查变量加载
systemctl show docker --property Environment
 
docker info
 
添加全局proxy
vim /etc/profile
添加
export http_proxy=http://127.0.0.1:8118
export https_proxy=http://127.0.0.1:8118
export NO_PROXY=localhost,127.0.0.1,10.64.0.0/16,registry.dida100.cn
 
 
 
 
 
 
每台机器安装kubelet和kubeadm
vi /etc/yum.repos.d/kubernetes.repo
[kubernetes]
name=Kubernetes
baseurl=https://packages.cloud.google.com/yum/repos/kubernetes-el7-x86_64
enabled=1
gpgcheck=1
repo_gpgcheck=1
gpgkey=https://packages.cloud.google.com/yum/doc/yum-key.gpg
 
setenforce 0 禁用selinux
systemctl stop firewalld
systemctl disable firewalld
vim /etc/sysctl.d/kubernetes.conf
添加
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
 
 
yum install -y docker kubelet kubeadm kubectl kubernetes-cni
systemctl enable docker && systemctl start docker
 
systemctl enable kubelet && systemctl start kubelet
 
 
vim /etc/sysctl.d/kubernetes.conf
添加
net.bridge.bridge-nf-call-ip6tables = 1
net.bridge.bridge-nf-call-iptables = 1
 
 
kubeadm init --pod-network-cidr 10.244.0.0/16 --kubernetes-version latest
 
部署flannel 网络
yum install -y git
cd /home/flannel/Documentation
kubectl create -f kube-flannel.yml
kubectl create -f kube-flannel-rbac.yml
 
去掉/etc/profile 加上的proxy
 
export KUBECONFIG=/etc/kubernetes/admin.conf
 
通过master初始化输出添加node
 
 
测试DNS
 
kubectl run curl --image=radial/busyboxplus:curl -i --tty
Waiting for pod default/curl-2421989462-vldmp to be running, status is Pending, pod ready: false
Waiting for pod default/curl-2421989462-vldmp to be running, status is Pending, pod ready: false
If you don't see a command prompt, try pressing enter.
[ root@curl-2421989462-vldmp:/ ]$
进入后执行nslookup kubernetes.default确认解析正常。
 
 
 
 
posted @ 2017-08-25 10:40  永不停息的老杜  阅读(270)  评论(0)    收藏  举报