CentOS kubernetes单机部署

CentOS kubernetes单机部署

1、关闭防火墙

systemctl disable firewalld
systemctl stop firewalld

2、安装etcd和kubernetes软件(会自动安装docker)

yum install -y etcd kubernetes

** 需要修改两处配置:**

  • Docker 配置文件/etc/sysconfig/docker , OPTIONS='--seliunx-enabled=false --insecure-registry gcr.io'
  • kubernetes apiservce 配置文件/etc/kubernetes/apiserver,把--admission_control参数中的ServiceAccount删除。

3、按下面的顺序启动所有服务:

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

** 安装完成:**
ps -ef|grep kube查看一下。

停止:

systemctl stop kube-proxy
systemctl stop kubelet
systemctl stop kube-scheduler
systemctl stop kube-controller-manager
systemctl stop kube-apiserver
systemctl stop docker
systemctl stop etcd

可以开始使用了!

apiVersion: v1
kind: ReplicationController
metadata:
  name: myweb
spec:
  replicas: 5
  selector:
    app: myweb
  template:
    metadata:
      labels:
        app: myweb
    spec:
      containers:
      - image: kubeguide/tomcat-app:v1
        name: myweb
        resources:
          limits:
            cpu: "2"
            memory: 4Gi
        ports:
        - containerPort: 8080
        env:
        - name: MYSQL_SERVICE_HOST
          value: 'mysql'
        - name: MYSQL_SERVICE_PORT
          value: '3306'


上一篇:主流的微服务框架


下一篇:使用 Docker Compose 管理多个容器