Skip to main content

Primary links

  • Home
  • AI
  • Kubernetes
  • Incus
  • Ansible
  • Terraform
  • OpenStack
  • Virtualization
  • Linux
  • SmartHome
  • HowTo

Misc

  • Linux
  • Hardware
  • Programming
  • Databases
  • Multimedia
  • Windows

Cloud

  • OpenStack
  • cloud-config
  • nextcloud

Virtualization

  • Virtualization
  • Incus
  • Docker
  • KVM
  • Kubernetes
  • LXC
  • LXD
  • QEMU
  • VMware
  • VirtualBox
  • multipass
  • podman
  • vagrant
  • XEN

Network

  • DNS
  • Firewall
  • Linux
  • OpenvSwitch
  • SSL
  • VLAN
  • VPN
  • iPXE
  • namespaces
  • nmcli
  • tcpdump

Storage

  • CEPH
  • DRBD
  • LVM
  • S3
  • ZFS
  • btrfs

Automation / CI/CD

  • Install
  • Ansible
  • GitLab
  • LLM
  • Preseed
  • Puppet
  • Terraform
  • Ubuntu autoinstall

Monitoring / Visualisation

  • Grafana
  • Icinga
  • Prometheus
  • Monitoring
  • ELK
  • mermaid

OpenStack: Magnum

Documentation
https://docs.openstack.org/magnum/latest/user/

Pre-requirements

# install OSC magnum client to fix "a bytes-like object is required, not 'str'"
echo "deb http://archive.ubuntu.com/ubuntu hirsute main restricted" > /etc/apt/sources.list.d/hirsute.list
apt update
apt install -y python3-magnumclient

# install kubectl
snap install kubectl --classic

CLI

openstack stack list
openstack stack show d8a1c3af-7993-4493-91be-19cfce38a870
openstack coe cluster update k8s-cluster replace node_count=2

Configure deployment kolla-ansible

# cat /etc/kolla/config/magnum.conf 
[cinder]
default_docker_volume_type = VT1

[trust]
cluster_user_trust = True

/etc/kolla/config/heat.conf 
[DEFAULT]
#region_name = ch-zh1
region_name_for_services = RegionOne

# /etc/kolla/globals.yml 
# magnum_tag: "7.0.0.1"
enable_magnum: "yes"

Redeploy / Reconfigure container

kolla-ansible -i /etc/kolla/inventory-hosts deploy -t magnum

Get Fedora AtomicHost images
https://dl.fedoraproject.org/pub/alt/atomic/stable/?C=M;O=D

Kubernetes dashboard UI

Add user and configure permissions

cat < /tmp/dashboard-adminuser.yaml
apiVersion: v1
kind: ServiceAccount
metadata:
  name: admin-user
  namespace: kube-system
EOF
kubectl apply -f /tmp/dashboard-adminuser.yaml
cat < /tmp/kubernetes-dashboard-admin.rbac.yaml
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
  name: admin-user
roleRef:
  apiGroup: rbac.authorization.k8s.io
  kind: ClusterRole
  name: cluster-admin
subjects:
- kind: ServiceAccount
  name: admin-user
  namespace: kube-system
EOF
kubectl apply -f /tmp/kubernetes-dashboard-admin.rbac.yaml

Get dashboard token

kubectl -n kube-system describe secret $(kubectl -n kube-system get secret | grep admin-user | awk '{print $1}') | grep token: | awk '{print $2}'

Start proxy and open Kubernetes Dashboard

CLUSTER=foo-k8s-cluster1
CLUSTER_IP=$(openstack coe cluster show ${CLUSTER} -c master_addresses -f value | cut -d"'" -f2)
echo ${CLUSTER_IP}

#ssh -L 8001:localhost:8080 fedora@10.0.10.111
ssh -L 8001:localhost:8080 fedora@${CLUSTER_IP}
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

kubectl proxy

Kubernetes Dashboard URL
http://localhost:8001/api/v1/namespaces/kube-system/services/https:kubernetes-dashboard:/proxy/

Links
https://github.com/kubernetes/dashboard/wiki/Creating-sample-user
https://www.twblogs.net/a/5c4adb6fbd9eee6e7e06a9b0
https://kubernetes.io/docs/tasks/access-application-cluster/web-ui-dashboard/
https://github.com/kubernetes/dashboard/wiki/Access-control#admin-privileges

iLO recovery broken flash

# Install ftp client
sudo apt install -y ftp

# Connect to iLo IP
ftp ILO_IP
# user: root
# pass: flash

# Transfer iLo image in binary mode
bin
put ilo4_262.bin

Links
https://community.hpe.com/t5/BladeSystem-Management-Software/iLO-network-flash-recovery-state/td-p/2322975#.XLyRCt9fi00

Visual Studio Code

Install from snap repository

# install
sudo snap install code --classic

Install from APT repository

# deb download
# https://code.visualstudio.com/docs/setup/linux
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg
sudo install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list'

sudo apt-get install apt-transport-https
sudo apt-get update
sudo apt-get install code # or code-insiders

# manual download
wget -q https://update.code.visualstudio.com/latest/linux-deb-x64/stable -O /tmp/code.deb
sudo dpkg -i /tmp/code.deb

# create starter
cat << EOF> /usr/share/applications/code.desktop
[Desktop Entry]
Name=Visual Studio Code
Exec=/snap/bin/code %U
Icon=/snap/code/current/usr/share/pixmaps/com.visualstudio.code.png
Type=Application
StartupNotify=false
Categories=Utility;TextEditor;Development;IDE;
Actions=new-empty-window;
EOF

Configure Visual Studio Code as default text editor

xdg-mime default code.desktop text/html
# xdg-mime default code.desktop text/plain
xdg-mime default code_code.desktop text/plain

# old
mkdir -p ~/.local/share/applications
cat <> ~/.local/share/applications/mimeapps.list
[Default Applications]
text/plain = code.desktop
text/x-shellscript = code.desktop
EOF

sed -i 's|text/plain = .*|text/plain = code.desktop|g' ~/.local/share/applications/mimeapps.list

Keyboard shortcuts for Linux
https://code.visualstudio.com/shortcuts/keyboard-shortcuts-linux.pdf

Oracle SQL Developer Extension for VSCode
https://marketplace.visualstudio.com/items?itemName=Oracle.sql-developer

ext install Oracle.sql-developer

Extensions
https://github.com/viatsko/awesome-vscode

Terraform
# code fromatting works only when directory is opened?
https://medium.com/nerd-for-tech/how-to-auto-format-hcl-terraform-code-in-visual-studio-code-6fa0e7afbb5e
https://marketplace.visualstudio.com/items?itemName=HashiCorp.terraform
https://github.com/hashicorp/vscode-terraform

Snap (Ubuntu package management)

Snap package search
https://snapcraft.io/store

Install

sudo apt install -y snapd

Configure proxy
https://snapcraft.io/docs/system-options
http://www.panticz.de/proxy (encrypt spedial characters in proxy password)

sudo snap set system proxy.https="${https_proxy}"
sudo snap set system proxy.http="${http_proxy}"

CLI

systemctl status snapd

snap find
snap install
snap info 

# update
snap refresh

# Update packages
snap refresh --list

# purge package
snap remove --purge libreoffice

Configure proxy (DEPRECTED)

# sudo mkdir -p /etc/systemd/system/snapd.service.d/
# echo "[Service]
# Environment=\"http_proxy=${http_proxy}\"
# Environment=\"https_proxy=${https_proxy}\"" | sudo tee /etc/systemd/system/snapd.service.d/http-proxy.conf

# sudo systemctl daemon-reload
# sudo systemctl restart snapd

# # debug proxy
# systemctl show snapd | grep proxy

# ###############################3
# # proxy test (broken?)
# # cat /etc/environment
# http_proxy="http://BENUTZER:PASSWORD@proxy.hostname.de:8080/"
# https_proxy="http://BENUTZER:PASSWORD@proxy.hostname.de:8080/"

# sudo systemctl edit snapd.service
# [Service]
# EnvironmentFile=/etc/environment

# sudo systemctl daemon-reload
# sudo systemctl restart snapd.service

Configure proxy (Ansible)

---
- hosts: localhost
  tasks:
    - name: Configure snap proxy
      become: yes
      ini_file:
        path: /etc/systemd/system/snapd.service.d/http-proxy.conf
        section: Service
        option: Environment
        value: '"http_proxy=http://proxy.example.com:8080"'
        mode: 0644
        create: yes
      notify: restart snapd

  handlers:
    - name: restart snapd
      systemd:
        name: snapd
        state: restarted
        daemon_reload: yes

Service
https://snapcraft.io/docs/service-management

Cleanup old versions

OpenStack: Application credentials

List application credentials

openstack application credential list

Create application credentials (with pre-formated output for clouds.yaml)

openstack application credential create foo-dev-admin \
  --role admin \
  --expiration $(date -I -d '+3 month')T23:59:59  \
  --description "Test application credentials" \
  --unrestricted \
  -c id \
  -c secret \
  -f json \
  | jq -r '"application_credential_id: \"" + .id + "\"", "application_credential_secret: \"" + .secret + "\""'

Configure clouds.yml

# ~/.config/openstack/clouds.yaml
clouds:
  dev-foo-unrestricted:
    auth_type: "v3applicationcredential"
    auth:
      auth_url: https://keystone.example.com/v3
      application_credential_id: "b9275fc5b3aadceeb407fbe941427425"
      application_credential_secret: "HqfdfKk3q63xrnIZgdkizePfv1s27aYPBTrbiMKFNdrOU1JpdjfR0KSyomS4A01vSdxjkE9MzPuM4dVG7emWuA"

Test application credentials

openstack --os-cloud=dev-foo-unrestricted image list

Delete application credentials

openstack application credential delete ${APPLICATION_CREDENTIAL_ID}

Links
https://docs.openstack.org/python-openstackclient/latest/cli/command-objects/application-credentials.html

OpenStack: Heat

Links
https://www.ibm.com/support/knowledgecenter/de/SS4KMC_2.5.0/com.ibm.ico.doc_2.5/r_heat_template_examples.html

Open vSwitch (OVS)

Install

apt install -y openvswitch-switch

List

# list interfaces
docker exec openvswitch_vswitchd ovs-vsctl list-ifaces br-int

# show bridges
docker exec openvswitch_vswitchd ovs-vsctl list-br

# show ports
docker exec openvswitch_vswitchd ovs-vsctl list-ports br-int

Create interface
https://docs.openstack.org/octavia/latest/install/install-ubuntu.html

# create bridge
ovs-vsctl add-br mybridge
# ifconfig mybridge up
ip link set mybridge up
ovs-vsctl show
ovs-dpctl show

# create
echo docker exec openvswitch_vswitchd ovs-vsctl -- --may-exist add-port br-int my-if1 -- \
set Interface my-if1 type=internal -- \
set Interface my-if1 external-ids:iface-status=active -- \
set Interface my-if1 external-ids:attached-mac=${CTL_HOST_MAC} -- \
set Interface my-if1 external-ids:iface-id=${PORT_ID} -- \
set Interface my-if1 external-ids:skip_cleanup=true

# Create port
openvswitch_vswitchd ovs-vsctl -- --may-exist add-port br-int my-port1 -- \
    set Interface o-hm0 type=internal -- \
    set Interface o-hm0 mac="${PORT_MAC}" -- \
    set Interface o-hm0 external-ids:iface-status=active -- \
    set Interface o-hm0 external-ids:iface-id=${PORT_ID} -- \
    set Interface o-hm0 external-ids:skip_cleanup=true -- \
    set Interface o-hm0 external-ids:attached-mac=${PORT_MAC}

# create vlan
ovs-vsctl add-port br0 vlan10 tag=10 -- set Interface vlan10 type=internal
ip addr add 192.168.0.123/24 dev vlan10

Show / List

ovs-vsctl show

ovs-vsctl list bridge
ovs-vsctl list port
ovs-vsctl list interface

Create

ovs-vsctl -- --may-exist add-port br-int o-hm0 -- \
set Interface o-hm0 type=internal -- \
set Interface o-hm0 external-ids:iface-status=active -- \
set Interface o-hm0 external-ids:attached-mac=${CTL_HOST_MAC} -- \
set Interface o-hm0 external-ids:iface-id=${PORT_ID} -- \
set Interface o-hm0 external-ids:skip_cleanup=true

Delete

# delete port
ovs-vsctl del-port br-int o-hm0

# delete ovs-tcpdump port
ovs-vsctl del-port br-tun ovsmiXXXXXX

# delete bridge
ovs-vsctl del-br mybridge

CLI
http://www.sznote.net/?p=1032

OpenStack: Glance (Image)

Deaktivate image

IMAGE_NAME="Ubuntu 14.04"
openstack image list --status active --name "${IMAGE_NAME}" -c ID -f value | \
  xargs openstack image set --deactivate --private

openstack image list --status active

List the images

openstack image list

Delete image

IMAGE_NAME="Ubuntu 16.04"
openstack image set --unprotected ${IMAGE_NAME}
openstack image delete ${IMAGE_NAME}

# delete all images
for IMAGE in $(openstack image list -c ID -f value); do
    openstack image set --unprotected ${IMAGE}
    openstack image delete ${IMAGE}
done

Deploy ISO image

openstack image create grml \
  --file grml64-small_2018.12.iso \
  --disk-format iso \
  --container-format bare

Find images used by server

for IMAGE in $(openstack image list | grep ubuntu | cut -d" " -f2); do
    echo "IMAGE: ${IMAGE}"
    openstack server list --all-projects --image ${IMAGE}
    echo
done

Get server image project relation

export OS_CLOUD=dev
echo SERVER_ID IMAGE PROJECT_ID
for IMAGE in $(openstack image list -c ID -c Name -f value | grep -i "Windows Server" | cut -d" " -f1); do
    for SERVER in $(openstack server list --all-projects --image ${IMAGE} -c ID -f value); do
        openstack server show ${SERVER} -f value -c id -c image -c project_id | paste - - -
        # openstack project show sd32sd0fsdfj9sdf9sdf0sda7fsda -f value -c name 
    done
done

openstack project show XXX --os-cloud=dev  -f value -c name
openstack server show XXX --os-cloud=dev -f value -c name

Shared images

OpenStack: Live migrate VM to another OpenStack hypervisor

show migrate state / log

nova migration-list --instance-uuid  ${SERVER_ID}

# show multiple migrations by date
nova migration-list | grep 2020-02-20 | awk -F"|" '{ print $8}' | sort | uniq -dc

CLI

Pagination

  • First page
  • Previous page
  • …
  • Page 14
  • Page 15
  • Page 16
  • Page 17
  • Page 18
  • Page 19
  • Page 20
  • Page 21
  • Page 22
  • …
  • Next page
  • Last page
Profiles GitHub StackOverflow LinkedIn Xing
Contact Imprint
© panticz 2026

Cookie-Einstellungen

Diese Website nutzt eingebettete Inhalte von Drittanbietern (z.B. YouTube, SoundCloud). Beim Laden dieser Inhalte werden Daten an die jeweiligen Anbieter übermittelt. Datenverarbeitungserklärung