kubernetes入门

一、快速入门
    1、关闭防火墙
        systemctl disable firewalld
        systemctl stop firewalld
    2、安装etcd和kubernetes软件
        yum update
        yum install -y etcd kubernetes
    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
    4、配置
        A、tomcat配置
            a、mkdir /usr/local/k8s
            b、cd /usr/local/k8s
            c、vim mytomcat.rc.yaml
            d、kubectl create -f mytomcat.rc.yaml
            e、vim mytomcat.svc.yaml
            f、kubectl create -f mytomcat.svc.yaml
            g、kubectl get pods
            h、kubectl get svc
    5、问题解决
        A、kubectl get pods(ContainerCreating问题解决)
        B、kubectl get pods(No resources found问题解决)
            vim /etc/kubernetes/apiserver
            KUBE_ADMISSION_CONTROL删除ServiceAccount,选项
            systemctl restart kube-apiserver

备注:
1、mytomcat.rc.yaml
apiVersion: v1
kind: ReplicationController
metadata:
  name: mytomcat
spec:
  replicas: 2
  selector:
    app: mytomcat
  template:
    metadata:
      labels:
        app: mytomcat
    spec:
      containers:
        - name: mytomcat
          image: tomcat:8-jre8
          ports: 
          - containerPort: 8080
2、mytomcat.svc.yaml
apiVersion: v1
kind: Service
metadata:
  name: mytomcat
spec:
  type: NodePort
  ports:
    - port: 8080
      nodePort: 30001
  selector:
    app: mytomcat

 

kubernetes入门

上一篇:7_JSP


下一篇:html标签语义化