kubernetes部署ubuntu跳板机

  sre

Deployment

apiVersion: apps/v1
kind: Deployment
metadata:
  name: ubuntu-desktop
spec:
  replicas: 1
  selector:
    matchLabels:
      name: ubuntu-desktop
  template:
    metadata:
      labels:
        name: ubuntu-desktop
    spec:
      containers:
      - name: ubuntu-desktop
        image: dorowu/ubuntu-desktop-lxde-vnc
        imagePullPolicy: IfNotPresent
        ports:
        - containerPort: 6079
          name: vnc-web
        - containerPort: 5900
          name: vnc-port
        env:
        - name: VNC_PASSWORD
          value: "123456"
        - name: RESOLUTION
          value: "1280x720"
        volumeMounts:
        - mountPath: /dev/shm
          name: dev-shm
      volumes:
      - name: dev-shm 
        hostPath:
          path: /dev/shm 
          type: Directory


svc vnc

kind: Service
apiVersion: v1
metadata:
  name: vnc
spec:
  type: NodePort
  ports:
  - name: vnc
    port: 5900
    nodePort: 30085
    targetPort: 5900
    protocol: TCP
  selector:
    name: ubuntu-desktop

svc vnc-web

kind: Service
apiVersion: v1
metadata:
  name: vnc-web
spec:
  type: NodePort
  ports:
  - name: vnc-web
    port: 6079
    nodePort: 30084
    targetPort: 6079
    protocol: TCP
  selector:
    name: ubuntu-desktop

LEAVE A COMMENT

Captcha Code