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

相关推荐
用户11481867894845 分钟前
盲水印:DCT-QIM 从原理到踩坑
前端
吴声子夜歌7 分钟前
Kubernetes权威指南——Kubernetes安装配置指南(二进制文件安装)
容器·kubernetes
程序00710 分钟前
天地图实现收货地址定位
前端·javascript·css
去伪存真15 分钟前
架构思考与演进:如何彻底破解 RAG 切块大小与语义完整性的工程悖论?
前端·agent
馒头不想说话24 分钟前
AI剪辑工具降低创作门槛
前端
江华森32 分钟前
Kubernetes集群部署实战:使用kubeadm在4台ECS服务器上搭建K8s v1.31集群
云原生·容器·kubernetes
paopaokaka_luck35 分钟前
社区服务平台(加权协同过滤推荐、Jieba中文词频分析、WebSocket实时聊天、求助处理闭环、 活动积分闭环、ECharts多维分析)
java·前端·spring boot·mysql·echarts·mybatis
墨林陌1 小时前
翻完 DeepSeek 的 GitHub 仓库,我发现 V5 的发布路已经修好了
前端
闲云自留地1 小时前
K8s Ingress 全解:ingress-nginx 部署、域名路径路由、HTTPS 限流灰度一篇通
nginx·https·kubernetes