使用K8S部署【Docker 可视化管理工具-DockerUI】

第一步:编写DockerUI YAML资源清单文件:

cat docker-ui.yaml 
---
apiVersion: v1
kind: Namespace
metadata:
  name: docker-ui
---
apiVersion: v1
kind: Service
metadata:
  name: docker-ui-svc
  namespace: docker-ui
spec:
  type: NodePort
  ports:
  - targetPort: 8999
    port: 80
    protocol: TCP
    nodePort: 30001
  selector:
    app: docker-ui
    env: uat
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: docker-ui
  namespace: docker-ui
  labels:
    app: docker-ui
    env: uat
spec:
  replicas: 5
  selector:
    matchLabels:
      app: docker-ui
      env: uat
  strategy:
    rollingUpdate:
      maxSurge: 1
      maxUnavailable: 0
  template:
    metadata:
      name: docker-ui
      namespace: docker-ui
      labels:
        app: docker-ui
        env: uat
    spec:
      volumes:
      - name: docker-sock
        hostPath:
          path: /run/docker.sock # 宿主机sock路径
          type: Socket
      containers:
      - name: docker-ui
        image: joinsunsoft/docker.ui:1.0.1
        imagePullPolicy: IfNotPresent
        volumeMounts:
        - name: docker-sock
          mountPath: /var/run/docker.sock
        startupProbe:
          initialDelaySeconds: 20   
          periodSeconds: 20         
          successThreshold: 1       
          timeoutSeconds: 30        
          failureThreshold: 2       
          tcpSocket:
            port: 8999
        livenessProbe:
          httpGet:
            path: "/main.html"
            port: 8999
          initialDelaySeconds: 20   
          periodSeconds: 20         
          successThreshold: 1       
          timeoutSeconds: 30        
          failureThreshold: 2       
        readinessProbe:
          httpGet:
            path: "/main.html"
            port: 8999
          initialDelaySeconds: 20   
          periodSeconds: 20         
          successThreshold: 1       
          timeoutSeconds: 30        
          failureThreshold: 2       

第二步:执行YAML资源清单文件:

kubectl apply -f docker-ui.yaml

第三步:查看Pod状态

kubectl get pods -n docker-ui

使用K8S部署【Docker 可视化管理工具-DockerUI】_第1张图片
第四步:通过浏览器访问
http://节点地址:30001,默认账号密码:ginghan/123456

使用K8S部署【Docker 可视化管理工具-DockerUI】_第2张图片
第五步:登入后页面
使用K8S部署【Docker 可视化管理工具-DockerUI】_第3张图片
OK,到此结束,开源Docker 可视化管理工具-DockerUI,的其他功能请参考官网。

你可能感兴趣的:(#,docker,kubernetes,容器)