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

相关推荐
码途漫谈3 分钟前
Scrapling:让爬虫在现代 Web 里“活下来”的自适应抓取框架
前端·爬虫·ai·开源
极梦网络无忧7 分钟前
我开源了一个 Vue 3 动态表单组件库 —— real-vue3-easy-form
前端·vue.js·开源
ShyanZh9 分钟前
【Claude基础】多代理协作:Agent Teams 与编排模式
前端·chrome·ai
下载居12 分钟前
Google Chrome(谷歌浏览器64位) 148.0.7778
前端·chrome
2301_7807896616 分钟前
容器环境漏洞扫描:适配 K8s 架构的镜像与 Pod 安全检测方案
网络·安全·web安全·云原生·架构·kubernetes·ddos
运维老郭17 分钟前
【K8s 调度三阶段 · 避坑完全指南】过滤→打分→绑定,9 成 Pending 都卡在第一关
运维·云原生·kubernetes
云游牧者18 分钟前
深入理解K8S-Pod生命周期与资源管理-CSDN博客
kubernetes·探针·pod生命周期·pod优雅终止
MXN_小南学前端20 分钟前
Vue + Quill:富文本的添加、传输、展示逻辑,以及 csReplyQuill 组件封装
前端·vue.js
XS03010621 分钟前
Java Web实现简易CRUD操作笔记
java·前端·笔记
Shadow(⊙o⊙)23 分钟前
qt内详解信号和槽的基本概念+实例演示
开发语言·前端·c++·qt·学习