一、环境
64位centos
二、安装
(1)关闭防火墙
systemctl stop firewalld
systemctl disable firewalld
(2)安装etcd与kubernetes(会自动安装docker)
yum install -y etcd kubernetes
(3)安装好后,修改两个配置文件
1)vi /etc/sysconfig/docker ,其中OPTIONS的内容设置为:
OPTIONS='--selinux-enable=false --instance-registry.io grc.io'
2)vi /etc/kubernetes/apiserver ,把--adminssion_control参数的ServiceAccount删除。
(4)按顺序启动所有的服务
systemctl start etcd
systemctl start docker
systemctl start kube-apiserver
systemctl start kube-controller-manager
systemctl start kube-scheduler
systemctl start kubelet
systemctl start kube-proxy
附上样例yaml例子(格式严格遵守空格缩进,不能使用制表符)
apiVersion: v1 kind: ReplicationController metadata: name: mysql spec: replicas: 1 selector: app: mysql template: metadata: labels: app: mysql spec: containers: - name: mysql image: mysql ports: - containerPort: 3306 env: - name: MYSQL_ROOT_PASSWORD value: "root"