分享个好玩的,在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:- ReadWriteOncecapacity:storage: 64GiclaimRef:apiVersion: v1kind: PersistentVolumeClaimname: macos-pvcnamespace: macoshostPath:path: /data/macostype: DirectoryOrCreatepersistentVolumeReclaimPolicy: RetainvolumeMode: Filesystem---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:name: macos-pvc
spec:accessModes:- ReadWriteOnceresources:requests:storage: 64Gi
---
apiVersion: v1
kind: Pod
metadata:name: macoslabels:name: macos
spec:terminationGracePeriodSeconds: 120 # the Kubernetes default is 30 seconds and it may be not enoughcontainers:- name: macosimage: dockurr/macosports:- containerPort: 8006protocol: TCP- containerPort: 5000protocol: TCP- containerPort: 5000protocol: UDPsecurityContext:privileged: trueenv:- name: RAM_SIZEvalue: 4G- name: CPU_CORESvalue: "2"- name: DISK_SIZEvalue: "64G"volumeMounts:- mountPath: /storagename: storage- mountPath: /dev/kvmname: dev-kvmvolumes:- name: storagepersistentVolumeClaim:claimName: macos-pvc- name: dev-kvmhostPath:path: /dev/kvm
---
apiVersion: v1
kind: Service
metadata:name: macos
spec:type: NodePortselector:name: macosports:- name: tcp-8006protocol: TCPport: 8006targetPort: 8006- name: tcp-5900protocol: TCPport: 5900targetPort: 5900- name: udp-5900protocol: UDPport: 5900targetPort: 5900
等待部署完成,查找service的端口
访问页面,使用VNC桌面有点卡顿