virtualization

warning: Creating default object from empty value in /data/web/1/000/027/003/273448/htdocs/panticz.de/modules/taxonomy/taxonomy.pages.inc on line 33.

VMware: Installation Tools

Install open-vm-tools package
sudo apt-get install -y open-vm-tools

# Ubuntu Offline install
wget http://mirrors.kernel.org/ubuntu/pool/main/o/open-vm-tools/open-vm-tools_10.0.7-3227872-2ubuntu1_amd64.deb
wget http://mirrors.kernel.org/ubuntu/pool/main/libd/libdumbnet/libdumbnet1_1.12-7_amd64.deb
wget http://security.ubuntu.com/ubuntu/pool/main/libm/libmspack/libmspack0_0.5-1ubuntu0.16.04.3_amd64.deb
scp *.deb :/tmp/
ssh dpkg -i /tmp/open-vm-tools_*_amd64.deb /tmp/libdumbnet*_amd64.deb /tmp/libmspack0_*_amd64.deb

# FreeBSD

Kubernetes

kubectl Cheat Sheet
https://kubernetes.io/docs/reference/kubectl/cheatsheet/

Dump Kubernetes Objects
kubectl get componentstatuses
kubectl get configmaps
kubectl get daemonsets
kubectl get deployments
kubectl get events
kubectl get endpoints
kubectl get horizontalpodautoscalers
kubectl get ingress
kubectl get jobs
kubectl get limitranges
kubectl get nodes
kubectl get namespaces
kubectl get pods
kubectl get pods --all-namespaces -o wide
kubectl get persistentvolumes
kubectl get persistentvolumeclaims
kubectl get quota

KVM Snapshot

virsh domblklist ${VM}
virsh blockcommit ${VM} vda --pivot
virsh domblklist ${VM}

# list snapshots
virsh snapshot-list ${VM}

# delete snapshot
virsh snapshot-delete ${VM} ${TIMESTAMP} --metadata

# fix "error: block copy still active: disk 'vda' already in active block job"
VM=vm1
virsh blockjob ${VM} vda --abort
virsh blockcommit ${VM} vda --pivot
virsh snapshot-list ${VM}
SNAP=1527804440
virsh snapshot-delete ${VM} ${SNAP} --metadata

# list snapshots
for VM in $(virsh list --state-running --name); do
echo ${VM}
virsh domblklist ${VM}

LXD

lxc profile delete default
lxc profile device add default root disk path=/ pool=default

lxc profile create default
lxd init
--auto

Install
apt install lxd lxd-client
# https://raw.githubusercontent.com/panticz/installit/master/install.lxd.sh

# Add user to group
sudo usermod -a -G lxd ${USER}

Create VM
lxc launch ubuntu:18.04 bionic
lxc launch ubuntu:trusty trusty
lxc launch ubuntu:16.04 xenial
lxc launch images:centos/7 centos7
lxc exec xenial bash
lxc delete xenial -f

Create priviliged VM
CONTAINER_NAME=vm1

VMware Player

wget -q --no-check-certificate https://raw.githubusercontent.com/panticz/installit/master/install.vmware-player.sh -O - | bash -

#!/bin/bash

URL=https://download3.vmware.com/software/player/file/VMware-Player-14.0.0-6661328.x86_64.bundle

# download
wget -q ${URL} -O /tmp/${URL##*/}

# install
sudo /tmp/${URL##*/} --console --required --eulas-agreed

sudo apt-get install -y open-vm-tools

Links
https://docs.vmware.com/en/VMware-Workstation-Player/12.0/com.vmware.player.linux.using.doc/GUID-42F4754B-7547-4A4D-AC08-353D321A051B.html

qcow2

# create image file
qemu-img create -f qcow2 /var/lib/libvirt/images/vm01.qcow2 25G

# create raw disk
chown libvirt-qemu.kvm /var/lib/libvirt/images/vm01.qcow2
chmod 600 /var/lib/libvirt/images/vm01.qcow2

# shrink qcow image
qemu-img convert -O qcow2 image01.in.qcow image.01.out.qcow

# shrink qcow image with compression
qemu-img convert -O qcow2 -c IN.qcow OUT.qcow

# convert
qemu-img convert -O qcow2 ubuntu-16.04-server-cloudimg-amd64-disk1.img ubuntu-16.04-server-cloudimg-amd64-disk1.qcow2

# create image
qemu-img create disk.img -f qcow2 4G

VMware

WebGui
https://example.com/vsphere-client/?csp
https://example.com/folder?dcPath=ha-datacenter

CLI
esxcli vm process list
esxcli network nic list
esxcli network ip interface list
esxcli network ip interface ipv4 get

esxcli hardware platform get

WebGui
https://esx.example.com/ui

Shrink MsSQL Express DB
https://benjaminulsamer.wordpress.com/2014/06/10/vcenter-database-full-how-to-purge-old-data-and-shrink-the-sql-express-database/

HowTo
# Ignore insufficient storrage count

brctl: network bridges

# create bridge
brctl addbr br0
ifconfig eth0 0.0.0.0

brctl delif lxcbr0 eth0
brctl addif br0 eth0
dhclient br0

# move VM to other bridge
for IF in $(brctl show | grep veth | sed 's/^

*//'); do
    brctl delif lxcbr0 ${IF}
    brctl addif br0 ${IF}
done
 
 
# connect two bridges?
ip link add veth0 type veth peer name veth1
ifconfig veth0 up
ifconfig veth1 up
 
brctl delif br0 veth0
brctl delif lxcbr0 veth1
 
 
# renew ip in VM
lxc-attach -n vm1 -- dhclient
 
 
# /etc/network/interfaces
auto eth0
iface eth0 inet manual
 
auto br0
iface br0 inet dhcp

Syndicate content