Skip to content

Instantly share code, notes, and snippets.

@suchakra012
Last active July 25, 2020 15:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save suchakra012/d3692421850d7a7631ef6340042a4ebc to your computer and use it in GitHub Desktop.
Save suchakra012/d3692421850d7a7631ef6340042a4ebc to your computer and use it in GitHub Desktop.
kubevirt commands in nutshel
Kubevirt demo :
export KUBEVIRT_VERSION=$(curl -s https://api.github.com/repos/kubevirt/kubevirt/releases/latest | jq -r .tag_name)
echo $KUBEVIRT_VERSION
------- Installing Kubevirt components using Operator ---------------
kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-operator.yaml
------- Pre-configure KubeVirt so it uses software-emulated virtualization (QEMU) --------------------------------
kubectl create configmap kubevirt-config -n kubevirt --from-literal debug.useEmulation=true
------- Deploy KubeVirt using CR that trigger's operator workflow to create deployment ----------------------------
kubectl create -f https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/kubevirt-cr.yaml
-------- Installing virtctl client tool ---------------------------
wget -O virtctl https://github.com/kubevirt/kubevirt/releases/download/${KUBEVIRT_VERSION}/virtctl-${KUBEVIRT_VERSION}-linux-amd64
chmod +x virtctl
mv virtctl /usr/local/bin/
--------- Deploy a sample VM deployment file ------------------------
wget https://raw.githubusercontent.com/kubevirt/demo/master/manifests/vm.yaml
kubectl create -f vm.yaml
kubectl get vm -- show that vm has been deployed (but not scheduled/running)
kubectl get vmis -- will not show unless vm is started
virtctl start testvm , kubectl describe vm testvm
virtctl stop testvm -- to stop vm
kubectl describe virtualmachineinstance myvm
virtctl console testvm
Successfully connected to testvm console. The escape sequence is ^]
login as 'cirros' user. default password: 'gocubsgo'. use 'sudo' for root.
kubectl delete vm testvm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment