分享个好玩的,在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桌面有点卡顿

相关推荐
feixing_fx1 小时前
变量与声明:let、const、var 的选择边界
开发语言·前端·javascript·前端框架
JavaGuide3 小时前
Cloudflare 开源的这套神级安全审计 Skill 太好用了!
前端·后端
孟健4 小时前
用 unslop 拯救 AI 生成网页的塑料感,7 分钟重构落地实测
前端·人工智能·ai编程
feixing_fx5 小时前
JavaScript 是什么:从浏览器脚本到通用编程语言
开发语言·前端·javascript·前端框架·ecmascript
丘山望岳5 小时前
【开发工具】 cluade code常用快捷键
前端
小巫编程室5 小时前
我造了一个 Java 能力包:让 AI 直接调用你的业务代码
java·前端·后端
小y的笔记5 小时前
JavaScript URL 状态同步
前端·javascript
十有八七5 小时前
手搓 Agent(五):学会翻书——RAG,先查资料再回答
前端·人工智能·后端
Swot5 小时前
产品 RAG 知识库与 AI 顾问 设计与实现
前端·后端
htzyl2067 小时前
前端样式-弹窗淡入淡出,为什么你的 `transition` 一直不生效
前端·css·html