课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。
介绍主要的k8s资源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,podDisruptionbudget,podSecurityPolicy,networkPolicy,resourceQuota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerRevision等。
详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件
mysql数据库:
apiVersion: v1 kind: ReplicationController metadata: name: mariadb-master labels: name: mariadb-master spec: replicas: 1 selector: name: mariadb-master template: metadata: labels: name: mariadb-master spec: nodeSelector: deploy: app containers: - name: mariadb-master image: mariadb:10.2.13 env: - name: MYSQL_DATABASE value: redmine - name: MYSQL_ROOT_PASSWORD value: admin ports: - containerPort: 3306 name: mariadb-master volumeMounts: - name: mariadb-persistent-storage mountPath: /var/lib/mysql livenessProbe: tcpSocket: port: 3306 initialDelaySeconds: 30 timeoutSeconds: 1 volumes: - name: mariadb-persistent-storage persistentVolumeClaim: claimName: pvc-mariadb
apiVersion: v1 kind: Service metadata: name: mariadb-master labels: name: mariadb-master spec: ports: - port: 3306 targetPort: 3306 protocol: TCP selector: name: mariadb-master
存储:
apiVersion: v1 kind: PersistentVolumeClaim metadata: labels: app: pvc-mariadb name: pvc-mariadb spec: accessModes: - ReadWriteMany storageClassName: glusterfs-storage resources: requests: storage: 8Gi
redmine:
apiVersion: v1 kind: ReplicationController metadata: name: redmine labels: name: redmine spec: replicas: 3 selector: name: redmine template: metadata: labels: name: redmine spec: nodeSelector: deploy: app containers: - name: redmine image: /hxpapp/redmine:3.4.4 env: - name: REDMINE_DB_MYSQL value: mariadb-master - name: REDMINE_DB_USERNAME value: root - name: REDMINE_DB_PASSWORD value: admin - name: REDMINE_DB_DATABASE value: redmine ports: - containerPort: 3000 protocol: TCP livenessProbe: httpGet: path: / port: 3000 initialDelaySeconds: 60 timeoutSeconds: 1
apiVersion: v1 kind: Service metadata: name: redmine labels: name: redmine spec: type: ClusterIP ports: - port: 80 targetPort: 3000 protocol: TCP selector: name: redmine
外部访问:
apiVersion: extensions/v1beta1 kind: Ingress metadata: name: redmine-ingress labels: app: redmine spec: rules: - host: redmine.youben.demo http: paths: - backend: serviceName: redmine servicePort: 80