在阿里云的ECS下(centos系统)安装k8s

手动在ecs上安装k8s全过程,根据度娘查找的资料整理如下:

1.yum install -y etcd kubernetes
2.vim /etc/sysconfig/docker
   # 内容改为如下  OPTIONS='--selinux-enabled=false --insecure-registry gcr.io'
3.vim /etc/kubernetes/apiserver 去掉–admission-control中的ServiceAccount

4.systemctl start etcd.service
5.systemctl start docker
6.systemctl start kube-apiserver.service
7.systemctl start kube-controller-manager.service
8.systemctl start kube-scheduler.service
9.systemctl start kubelet.service
10.systemctl start kube-proxy.service

11.yum install python-rhsm-certificates 

避免k8s下载镜像出错

12.运行wget http://mirror.centos.org/centos/7/os/x86_64/Packages/python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm 手动下载
13.chmod +x python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm 
14.运行 rpm2cpio python-rhsm-certificates-1.19.10-1.el7_4.x86_64.rpm | cpio -iv --to-stdout /etc/rhsm/ca/redhat-uep.pem | tee           /etc/rhsm/ca/redhat-uep.pem
15.运行 ll /etc/docker/certs.d/registry.access.redhat.com/redhat-ca.crt 指向正确


16.docker pull XXXX
17.编写yaml文件:

XXXX.yaml:
apiVersion: v1
kind: ReplicationController
metadata:
  name: myname
  labels:
    name: myname
spec:
  replicas: 2
  selector:
    name: myname
  template:
    metadata:
     labels:
       name: myname
    spec:
     containers:
     - name: myname
       image: helloWord
       imagePullPolicy: IfNotPresent
       ports:
       - containerPort: 8080

18.kubectl create -f xxxxx.yaml       
19.kubectl get rc
20.kubectl get pods
21.kubectl describe pod helloworld-7jpm5
22.kubectl logs helloworld-7jpm5

你可能感兴趣的:(kubernetes)