一、一台服务器上装k8s
centos7系统自带k8s的安装源。
默认kubernetes会有etcd,docker,kube-apiserver,kube-controller-manager,kube-scheduler,kubelet,kube-proxy等七个依赖服务
]#yum -y install kubernetes etcd
修改配置文件/etc/kubernetes/apiserver文件
去掉了KUBE_ADMISSION_CONTROL后面的SecurityContextDeny,ServiceAccount
###
# kubernetes system config
#
# The following values are used to configure the kube-apiserver
#
# The address on the local server to listen to.
KUBE_API_ADDRESS="--insecure-bind-address=127.0.0.1"
# The port on the local server to listen on.
# KUBE_API_PORT="--port=8080"
# Port minions listen on
# KUBELET_PORT="--kubelet-port=10250"
# Comma separated list of nodes in the etcd cluster
KUBE_ETCD_SERVERS="--etcd-servers=http://127.0.0.1:2379"
# Address range to use for services
KUBE_SERVICE_ADDRESSES="--service-cluster-ip-range=10.254.0.0/16"
# default admission control policies
KUBE_ADMISSION_CONTROL="--admission-control=NamespaceLifecycle,NamespaceExists,LimitRanger,ResourceQuota"
# Add your own!
KUBE_API_ARGS=""
二、关掉防火墙
]# systemctl stop firewalld
]# systemctl disable firewalld
三、依次启动服务
]# 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
上面只是单纯的搭建了k8s的服务,内网环境没有问题,容器内无法访问到外网。