分享个好玩的,在k8s上部署web版macos

参考github上这个项目dockur/macos

先拉取docker镜像

docker pull dockurr/macos

使用这个yaml文件进行部署

复制代码
apiVersion: v1
kind: PersistentVolume
metadata:
  annotations:
    pv.kubernetes.io/bound-by-controller: "yes"
    name: macos-pvc
spec:
  accessModes:
  - ReadWriteOnce
  capacity:
    storage: 64Gi
  claimRef:
    apiVersion: v1
    kind: PersistentVolumeClaim
    name: macos-pvc
    namespace: macos
  hostPath:
    path: /data/macos
    type: DirectoryOrCreate
  persistentVolumeReclaimPolicy: Retain
  volumeMode: Filesystem

---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
  name: macos-pvc
spec:
  accessModes:
    - ReadWriteOnce
  resources:
    requests:
      storage: 64Gi
---
apiVersion: v1
kind: Pod
metadata:
  name: macos
  labels:
    name: macos
spec:
  terminationGracePeriodSeconds: 120 # the Kubernetes default is 30 seconds and it may be not enough
  containers:
    - name: macos
      image: dockurr/macos
      ports:
        - containerPort: 8006
          protocol: TCP
        - containerPort: 5000
          protocol: TCP
        - containerPort: 5000
          protocol: UDP
      securityContext:
        privileged: true
      env:
        - name: RAM_SIZE
          value: 4G
        - name: CPU_CORES
          value: "2"
        - name: DISK_SIZE
          value: "64G"
      volumeMounts:
        - mountPath: /storage
          name: storage
        - mountPath: /dev/kvm
          name: dev-kvm
  volumes:
    - name: storage
      persistentVolumeClaim:
        claimName: macos-pvc
    - name: dev-kvm
      hostPath:
        path: /dev/kvm
---
apiVersion: v1
kind: Service
metadata:
  name: macos
spec:
  type: NodePort
  selector:
    name: macos
  ports:
    - name: tcp-8006
      protocol: TCP
      port: 8006
      targetPort: 8006
    - name: tcp-5900
      protocol: TCP
      port: 5900
      targetPort: 5900
    - name: udp-5900
      protocol: UDP
      port: 5900
      targetPort: 5900

等待部署完成,查找service的端口

访问页面,使用VNC桌面有点卡顿

相关推荐
江城开朗的豌豆4 分钟前
JavaScript篇:偷懒也有理!事件代理让我少写一半代码
前端·javascript·面试
云浪19 分钟前
掌握 CSS 倾斜函数
前端·css
ai产品老杨26 分钟前
实现自动化管理、智能控制、运行服务的智慧能源开源了。
前端·javascript·vue.js·前端框架·ecmascript
唐诗27 分钟前
优化 Nextjs 开发的个人博客首页,秒开!
前端·next.js
飞川撸码29 分钟前
web vue 项目 Docker化部署
前端·vue.js·docker·运维开发
默默无闻的白夜31 分钟前
【Vue】初学Vue(setup函数,数据响应式, 脚手架 )
前端·javascript·vue.js
萌萌哒草头将军36 分钟前
⚡⚡⚡Rstack 家族即将迎来新成员 Rstest🚀🚀🚀
前端·javascript·vue.js
江城开朗的豌豆1 小时前
Proxy:JavaScript中的'变形金刚',让你的对象为所欲为!
前端·javascript·面试
江城开朗的豌豆1 小时前
JavaScript中的instanceof:你的代码真的认识'自家孩子'吗?
前端·javascript·面试
JinSo1 小时前
create-easy-editor —— 快速搭建你的可视化编辑器
前端·前端框架·github