Skip to main content

Connecting to Your VM

This guide covers supported ways to access a virtual machine in Kube-DC: browser consoles, direct SSH, and serial or VNC sessions.

Prerequisites


Console Access via UI

The Console UI provides instant browser-based access to your VMs — no SSH keys or network configuration required.

Launch Browser Console

  1. Navigate to Virtual Machines in your project
  2. Click on your VM name to open the details page
  3. Click Launch Remote Console for graphical VNC access, or Launch SSH Terminal for a browser-based SSH session

VM Console Access Options

Remote Console opens a VNC session in your browser — useful for VMs with desktop environments or when you need to access the boot process or BIOS.

SSH Terminal opens a web-based terminal connected via SSH — works if the VM has the QEMU guest agent running and SSH keys configured.

Pasting into the remote console

Open the arrow tab on the left side of the VNC window, select Clipboard, paste the text into the box, and click Type into VM. This sends paced key events and therefore works at firmware, installer, login, and Linux text-console screens where a guest clipboard does not exist. Newlines are sent as Enter and tabs as Tab.

Editing the box also performs standard VNC clipboard synchronization for graphical guests that support it. Pressing Ctrl+V directly in a Linux TTY does not paste and may display ^V; use Type into VM there.

VNC User Access

For VNC access with password authentication:

  1. Access the VM via SSH or serial console
  2. Create a user with useradd -m <username>
  3. Set a password with passwd <username>
  4. The user can now log in via the VNC console using these credentials

SSH Access via Floating IP

For direct SSH access from your local machine, assign a Floating IP to your VM:

apiVersion: kube-dc.com/v1
kind: FIp
metadata:
name: my-vm-fip
spec:
externalNetworkType: public
vmTarget:
vmName: ubuntu
interfaceName: vpc_net_0
kubectl apply -f fip.yaml
kubectl get fip my-vm-fip

Once the FIP is Ready, SSH directly to the external IP:

ssh ubuntu@198.51.100.16

See Deploying VMs for complete FIP configuration.


SSH Access via LoadBalancer

To expose SSH without using a Floating IP, create a LoadBalancer service.

Using Default Gateway EIP

For projects with egressNetworkType: public, the default gateway EIP is public:

apiVersion: v1
kind: Service
metadata:
name: vm-ssh
annotations:
service.nlb.kube-dc.com/bind-on-default-gw-eip: "true"
spec:
type: LoadBalancer
selector:
vm.kubevirt.io/name: ubuntu
ports:
- name: ssh
port: 2222
targetPort: 22

Using Dedicated Public EIP

For projects with egressNetworkType: cloud, create a dedicated public EIP:

apiVersion: kube-dc.com/v1
kind: EIp
metadata:
name: vm-ssh-eip
spec:
externalNetworkType: public
---
apiVersion: v1
kind: Service
metadata:
name: vm-ssh
annotations:
service.nlb.kube-dc.com/bind-on-eip: "vm-ssh-eip"
spec:
type: LoadBalancer
selector:
vm.kubevirt.io/name: ubuntu
ports:
- name: ssh
port: 2222
targetPort: 22
kubectl apply -f vm-ssh-service.yaml
kubectl get svc vm-ssh

Connect using the LoadBalancer IP and custom port:

ssh -p 2222 ubuntu@<loadbalancer-ip>

For more options, see the Service Exposure Guide.


VirtCtl Console Access

The virtctl CLI provides direct serial console access without network connectivity — useful for troubleshooting network issues or accessing VMs during boot.

Install virtctl

Install a virtctl release compatible with the platform KubeVirt version. Follow the official KubeVirt installation guide, which covers release binaries and the Krew plugin.

Serial Console

# Open interactive console (press Ctrl+] to exit)
virtctl console ubuntu

VNC Session

# Open the session in the configured VNC viewer
virtctl vnc ubuntu

To connect a viewer yourself, keep a proxy open on a known local port:

virtctl vnc ubuntu --proxy-only --port 5900

Then connect the viewer to localhost:5900.

Kubernetes API tunneling

Standard Project roles do not include virtualmachineinstances/portforward. Consequently, virtctl ssh and virtctl port-forward are not tenant access methods on Kube-DC. Use the browser SSH terminal, a Floating IP, or a LoadBalancer Service instead. Platform operators can use API tunneling only when they hold a separate diagnostic role that grants the subresource explicitly.


Connection Method Comparison

MethodUse CaseRequires NetworkRequires Public IP
Console UI (VNC)GUI access, troubleshooting bootNoNo
Console UI (SSH)Quick terminal accessNoNo
Floating IPDirect SSH from anywhereYesYes
LoadBalancerShared IP, custom portYesOptional
virtctl consoleSerial console, boot accessNoNo
virtctl vncVNC via API tunnelNoNo

Troubleshooting

SSH Connection Refused

  • Verify guest agent is running: kubectl get vmi ubuntu -o jsonpath='{.status.conditions[?(@.type=="AgentConnected")].status}'
  • Check if SSH keys are injected: virtctl console ubuntu and verify ~/.ssh/authorized_keys
  • Confirm SSH daemon is running inside the VM: systemctl status sshd

VNC Console Black Screen

  • VM may still be booting — wait for ReadinessProbe to show True: kubectl get vm ubuntu -o jsonpath='{.status.ready}'
  • Check if the VM has a graphical environment installed
  • Try accessing via serial console: virtctl console ubuntu

Cannot Access via Floating IP

  • Verify FIP status: kubectl get fip -o wide
  • Check if externalIP is assigned and ready: true
  • Test connectivity from the VM to external network: virtctl console ubuntu then ping 8.8.8.8

Next Steps