Category Archives: Learning

VMware with PowerShell on macOS

Part of my job responsibilities are managing a large VMware installation and a tool which I use frequently, is PowerShell with the VMware modules. The following is only how I installed it on macOS and is by far not the only way.

First, I use Brew, it just makes things easier for me to get all the tools that I require and keep them up to date easily. Click here if you could like to know how to install Brew.

Installing PowerShell via Brew

Installing PowerShell via Brew is very easy and can be done via a simple command:

brew cask install powershell

Once this is complete you can access PowerShell in one of two different ways. The first is once the installation is complete you’ll have a PowerShell icon in your applications folder. However, the easier way to access PowerShell will be via Terminal and typing:

sudo pwsh

Installing VMware modules into PowerShell

Next we will install the VMware modules, which is why we’re putting sudo in front so that we’re working as an Administrator.

sudo pwsh

Find-Module -Name VMware.PowerCLI

Install-Module -Name VMware.PowerCLI -Scope CurrentUser

Now let’s verify that everything got installed

Get-Command -Module *VMWare*

If everything went as expected you’ll see a long list of VMware modules.

Connecting to your vCenter

Connect-VIServer -Server vcenter.host.local -User administrator@vsphere.local -Password

So, now what?

For more detailed documentation that what’s found here, click this link.

To get a list of all your virtual machines:

get-vm

If you want to see a lot more information about each machine you can have that information spit out in a nice format list, like this:

get-vm | fl

A common task is moving virtual machines from here to there as users believe that memory and CPU are infinite. The following command would move the VM to the new ESXi host, via vMotion:

Move-VM -VM 'vmname' -Destination 'newesxi host'

The point of this post was to get everyone up and running on macOS with PowerShell and VMware. There are many resources on-line that will help you continue your journey.

MySQL 5.7 on SuSE 15

While people should be using MySQL 8.0, which is straight forward, what if you have a requirement to install the still supported 5.7 on SuSE 15? It requires a little more effort, but the following guide should make it a lot easier. This is based on a bare bone, minimal installation of SuSE so if you choose otherwise, you may not need to enable both repositories.

First download the following package from Oracle: mysql-5.7.27-1.sles12.x86_64.rpm-bundle.tar (I know it says sles12, but there is no 5.7 official package for sles15)

Secondly enable the following repositories:

  • SUSEConnect –product sle-module-basesystem/15.1/x86_64
  • SUSEConnect –product sle-module-legacy/15.1/x86_64 

Once this is complete install the following packages:

  • zypper install libatomic1 libnuma1 libnuma-devel libncurses5 perl-JSON libXtst6 libXtst-devel libXrender1 libasound2

At this point you will now be able to install the MySQL 5.7 RPM’s without issue!

Resizing LVM

Linux-logo-8EC59678CB-seeklogo.com

Many years ago now stumbling across this information was very useful to me. I figure now that unless it’s passed on again, with my own additional notes, how is the next person going to find it?

One of the great things about installing Linux with LVM (Logical Volume Manager) is that it is ridiculously easy to increase space on a virtual machine. On the platform of your choice add an additional HDD to the virtual machine and then follow these steps:

First, you need to be sure the system sees the new HDD that has been added. In this example, it is /dev/sdb.

fdisk -l
 
Disk /dev/sda: 42.9 GB, 42949672960 bytes
 255 heads, 63 sectors/track, 5221 cylinders
 Units = cylinders of 16065 * 512 = 8225280 bytes
 
Device Boot Start End Blocks Id System
 /dev/sda1 * 1 666 5345248+ 83 Linux
 Partition 1 does not end on cylinder boundary.
 /dev/sda2 666 5222 36596736 8e Linux LVM

Now that we know /dev/sdb has been found and is the size we expect:

pvcreate /dev/sdb
 Writing physical volume data to disk "/dev/sdb1"
 Physical volume "/dev/sdb1" successfully created

Use the vgs command find out the name of your volume group and then extend it to /dev/sdb:

vgs

VG #PV #LV #SN Attr VSize VFree
vg00 3 10 0 wz--n- 113.91g 34.97g

vgextend vg00 /dev/sdb
Volume group "vg00" successfully extended

Going down the line the next one up is to extend the logical volume:

lvs

LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 vg00 -wi-ao 29.06G
LogVol01 vg00 -wi-ao 5.81G 

lvextend -l +100%FREE /dev/vg00/LogVol00vg
Extending logical volume LogVol00 to 49.03 GB
Logical volume LogVol00 successfully resized

Make sure that it now sees all the space properly:

lvs

LV VG Attr LSize Origin Snap% Move Log Copy% Convert
LogVol00 vg00 -wi-ao 49.03G
LogVol01 vg00 -wi-ao 5.81G

Next we need to extend the actual filesystem itself and which path you choose depends if your running RHEL/CentOS 6.x or 7.x

For 6.x you would run:

resize2fs /dev/mapper/LogVol-vg00

For 7.x you would run:

xfs_growfx /dev/mapper/LogVol-vg00

This part can take a few seconds, minutes or longer depending upon the size you are undertaking and activity on the server. Again, if this is a highly active server you are going to need a maintenance window, do not try this during the day.

Getting started with Kubernetes

Kubernetes is the latest the latest hotness when it comes to technology used on the Internet. It has a distinct advantage of some of the previous trends in that it is very easy to get started learning.

Kubernetes and Docker for Mac

Like many people who love technology, I have Docker for Mac installed on my computer at home as well as at work. Why do I bring this up? Because if you have kept the software up to date you also, already, have Kubernetes installed.

If you do not have Docker for Mac installed: Click here.

Open Preferences for Docker in your toolbar and you’ll notice a familiar icon on the top bar:

Kuberentes preference Pane

Next, all you need to do is click the box next to Enable Kubernetes and then the Apply button. Next you’ll see a small popup that Kubernetes needs to be installed, click Install. That’s all it takes and and Kuberentes version 1.10.11 is stating up. Note, that you may want to click on the General tab as well and provide more memory.

Usage

Chances are you already have a connection to another cluster, such as one in Google Compute Cloud. You can easily change back and forth between that and your new Docker installation using contexts.

  • Run kubectl config get-contexts and it will list all of the available options. One of which will be your new installation.
  • Now, to use your Docker installation run kubectl config use-context docker-for-desktop
  • Next to double check that you’re up and running you can run something like kubectl describe nodes and look for a line which will say: OS Image: docker-for-desktop.

Minikube via Brew (Mac)

Installing Minikube on the Mac has a prerequisite in that you need a hypervisor. My recommendation is to go the free route and install Oracle’s VirtualBox.

Next up is to install Brew, if you do not already have it. I find this to be inavaluable installation on any Mac that I’m using.

After that all you need to do is run the following and Minikube will be installed!

brew cask install minikube

The following link will help you get started using Minikube!

https://kubernetes.io/docs/setup/minikube/

DevStack Formula

OpenStack®_Logo_2016.svg

Recently I started to get my hands dirty with learning more about DevStack which is a quick way to deploy OpenStack to test with. As with many of open source projects like OpenStack, OpenShift and Cloud Foundry I find the documentation often to be sorely lacking on specifics. In some cases I cannot explain why, in others it’s because they want you to use the paid version instead.

My stepup is on Ubuntu 18.04.1 and the local.conf that I used is below. All I can say is that this worked for me to just get it installed. How exactly functional after that I have not yet gotten to but hopefully this helps someone get started as well.

Note you will likely need to change the FLOATING_RANGE to match your network. The documentation is otherwise decent but I’ll include a few more getting started commands below:

Getting Started

sudo useradd -s /bin/bash -d /opt/stack -m stack

echo “stack ALL=(ALL) NOPASSWD: ALL” | sudo tee /etc/sudoers.d/stack

sudo su – stack

git clone https://git.openstack.org/openstack-dev/devstack

cd devstack

Create the local.conf listed below

Then lastly run ./stack

Local.conf

[[local|localrc]]

ADMIN_PASSWORD=nova
MYSQL_PASSWORD=nova
RABBIT_PASSWORD=nova

SERVICE_PASSWORD=$ADMIN_PASSWORD
SERVICE_TOKEN=nova

# Enable Swift

enable_service s-proxy s-object s-container s-account

# Enable sahara

enable_plugin sahara git://git.openstack.org/openstack/sahara

# Enable ceilometer

enable_plugin ceilometer git://git.openstack.org/openstack/ceilometer

SWIFT_HASH=66a3d6b56c1f479c8b4e70ab5c2000f5
SWIFT_REPLICAS=1
SWIFT_DATA_DIR=$DEST/data

# Check out from repos every time stack.sh is run
# This is optional and can be changed to no.

RECLONE=yes

# By default `stack.sh` will only install Python packages if no versi# on is currently installed, or the current version does not match a # specified requirement. If `PIP_UPGRADE` is set to `True` then exist# ing #required Python packages will be upgraded to the most recent v# ersion #that matches requirements. This is generally recommended,  # as most of # OpenStack is tested on latest packages, rather than ol# der versions.# The default is False.

PIP_UPGRADE=TRUE

# host ip

HOST_IP=127.0.0.1

# Change the FLOATING_RANGE to whatever IPs VM is working in. In NAT # mode it is the subnet VMware Fusion provides, in bridged mode it is# your local network. But only use the top end of the network by usin# g a /27 and starting at the 224 octet.

FLOATING_RANGE=10.0.1.224/27

# Logging

# By default ``stack.sh`` output only goes to the terminal where it runs.  It can be configured to additionally log to a file by setting ``LOGFILE`` to the full path of the destination log file.  A timestamp will be appended to the given name.

LOGFILE=$DEST/logs/stack.sh.log

# Old log files are automatically removed after 7 days to keep things neat.  Change the number of days by setting ``LOGDAYS``.

LOGDAYS=2

# basic syslog settings

SYSLOG=True
SYSLOG_HOST=$HOST_IP
SYSLOG_PORT=516

Coaching Part 1

Twenty-one years

I started out in technical support back in 1997 and I am here today because of the time that others took to help me along the way. Over the past year, I have been working hard to step up my efforts to hopefully do the same for others. Thanks to a program at work I really got to dive into what it means to coach someone in the workplace. Sometimes for technical people, it’s easier to just do it for someone when they ask for help. Yet, while it may be easier and faster it provides no benefit to the other person.

So that being said, this might be a rambling mess, but, I’ll do my best.

So how do you start? You listen. One thing I think that many of us are guilty of sometimes in conversation is that we are just waiting for the other person to stop talking so we can. It is an amazing thing that when you’re describing your problem to someone, seeking their help, that it’s obvious there really paying attention.

dilbertselfmentor

Next? Don’t do it for them, don’t give them the full answer. They are not going to learn anything if you give them the full answer. Instead, trust in that you’re working with clever, intelligent people who just need a pointer.

Going back to someone listening. I cannot tell you how many times I’ve come up with the solution myself just having someone listen to me. Three quarters through my rambling I often suddenly stop and go, “Wait a minute, I think I figured it out.” I thank them for their time and they often wonder what it is they did. Verbalizing your problem is an amazing way to find a solution.

That’s all for now. More rambling later.

Cheat Sheets

redhat-logo_0

Redhat has recently been pushing their new developer portal pretty hard. They have finally, to little to late in some peoples minds, opened up Redhat Enterprise Linux to developers for no charge. Along with this, they have a series of excellent cheat sheets which for those still learning, or just cannot remember every little command I’ve found to be very helpful.