Friday, October 2, 2020

How to mount a Remote vSAN Datastore. HCI Mesh

 Step 1: Select the "client" vSAN cluster (the one that wants to mount the other's datastore) and click on Configure. In this setup, both vSAN clusters are managed by the same vCenter server as you can see and happen to be in the same Datacenter.


Step 2: Under vSAN, select Datastore Sharing like shown below. Notice that two clusters exist in this case and both are controlled by the same vCenter Server.


Step 3: Click on MOUNT REMOTE DATASTORE


Step 4: Select the remote datastore and click on Next.


Step 5: Verify that everything looks good and click on Finish. Notice the two captures. One shows you why it may fail, the other one after fixing whatever may be incompatible with HCI Mesh.



Final Note: 

Verify that you can access both datastores from one cluster. Feel free to storage vMotion vms between the two datastores. Use commands like df -h or the gui to look at more information. According to Cormac Hogan, one cluster can mount up to 5 remote vSAN datastores. Be aware that HCI Mesh requires Enterprise or Enterprise + licenses.  

Useful YouTube video: https://www.youtube.com/watch?v=Dcdwy1wh-DM&feature=emb_title

Thursday, September 24, 2020

How to Create a Basic Docker Container

 How to create a basic Docker container


Step 1: install docker in your pc, laptop or vm.

# sudo apt-get install docker.io

# sudo systemctl start docker

# sudo systemctl enable docker

Step 2: create a directory for testing purposes and access such folder

# mkdir Dockerfiles

# cd Dockerfiles

Step 3: Create a docker file and call it Dockerfile

# vi Dockerfile

# Specify the base image to use, gets downloaded automatically

FROM ubuntu

# Specify the maintainer and email address

MAINTAINER *** <***@gmail.com

RUN apt-get update

# Specify the command to run

CMD [#echo", "Hello guys...! from my first image"]

Step 4: Build your image and tag it

# sudo docker build -t myimage:1.0 .

    Sending build context to Docker daemon  2.048kB

    Step 1/4 : FROM ubuntu

     ---> bb0eaf4eee00

    Step 2/4 : MAINTAINER *** <***@gmail.com>

     ---> Using cache

     ---> 2c30cf6f43fb

    Step 3/4 : RUN apt-get update

     ---> Using cache

     ---> 832660e5cdc3

    Step 4/4 : CMD ["echo", "Hello guys...! from my first image"]

     ---> Using cache

     ---> 168e1047d6a4

    Successfully built 168e1047d6a4

    Successfully tagged myimage:1.0

Step 5: List the images available

$ sudo docker image list

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

myimage             1.0                 b6f0f1350590        2 minutes ago       95.8MB

ubuntu              latest              bb0eaf4eee00        8 days ago          72.9MB

Step 6: Run the image for testing purposes

# sudo docker run image_id

    Hello guys...! from my first image

Final Note: 

You can pull more images to play with using sudo docker pull image_name

How to Deploy a Kubernetes Pod in vSphere

 What is a Kubernetes Pod?

A Pod is a Kubernetes structure that is used as a wrapper for one or multiple containers. Kubernetes manages pods rather than the containers directly.

1. Use kubectl to login and access your namespace. Create a yaml file like the one shown here. 


2. Use the kubectl apply command and point to the yaml file. 


3. Verify that the pod was created in the namespace.


4. Use the kubectl describe deployment command to learn about the pod created.



5. Modify the yaml file to scale the pod from one to three. Run the apply command.


6. Verify that there are three pods now.



How to build a Namespace with vSphere for Kubernetes

 What is a Namespace in Kubernetes?

A Namespace is  a feature that is use to divide cluster resources between multiple users. 

How to create a Namespace:

1. Launch the vSphere Client and log in as the administrator. Click on Create Namespace.



2. Select your vSphere Cluster and name it. Click on Create.


3. Verify that the Namespace has been created and click on Got It.


4. Click on Add Permissions


5. Specify the user, the identity source and the permissions for the user. 


6. Click on Add Storage and specify the storage policy. 


7. Use the kubectl commadnd to test your user. 




How to Install and Use Docker

 Step 1: Install Docker in a linux vm or physical machine. Ubuntu will be used in this demo.

# sudo apt-get install docker.io


Step 2: Start and enable docker

# sudo systemctl start docker

# sudo systemctl enable docker


Step 3: Verify the version of docker

# sudo docker -v

Docker version 19.03.8, build afacb8b7f0


Step 4: Learn about subcommands on your own

# sudo docker

Usage:      docker [OPTIONS] COMMAND

 A self-sufficient runtime for containers

 Options:

      --config string      Location of client config files (default

                           "/home/javier/.docker")

  -c, --context string     Name of the context to use to connect to the

                           daemon (overrides DOCKER_HOST env var and

                           default context set with "docker context use")

  -D, --debug              Enable debug mode

  -H, --host list          Daemon socket(s) to connect to

  -l, --log-level string   Set the logging level

                           ("debug"|"info"|"warn"|"error"|"fatal")

                           (default "info")

      --tls                Use TLS; implied by --tlsverify

      --tlscacert string   Trust certs signed only by this CA (default

                           "/home/javier/.docker/ca.pem")

      --tlscert string     Path to TLS certificate file (default

                           "/home/javier/.docker/cert.pem")

      --tlskey string      Path to TLS key file (default

                           "/home/javier/.docker/key.pem")

      --tlsverify          Use TLS and verify the remote

  -v, --version            Print version information and quit

 Management Commands:

  builder     Manage builds

  config      Manage Docker configs

  container   Manage containers

  context     Manage contexts

  engine      Manage the docker engine

  image       Manage images

  network     Manage networks

  node        Manage Swarm nodes

  plugin      Manage plugins

  secret      Manage Docker secrets

  service     Manage services

  stack       Manage Docker stacks

  swarm       Manage Swarm

  system      Manage Docker

  trust       Manage trust on Docker images

  volume      Manage volumes

 Commands:

  attach      Attach local standard input, output, and error streams to a running container

  build       Build an image from a Dockerfile

  commit      Create a new image from a container's changes

  cp          Copy files/folders between a container and the local filesystem

  create      Create a new container

  deploy      Deploy a new stack or update an existing stack

  diff        Inspect changes to files or directories on a container's filesystem

  events      Get real time events from the server

  exec        Run a command in a running container


Step 5: Test docker by running "hello world"

# sudo docker run hello-world

Hello from Docker!

This message shows that your installation appears to be working correctly.

 To generate this message, Docker took the following steps:

 1. The Docker client contacted the Docker daemon.

 2. The Docker daemon pulled the "hello-world" image from the Docker Hub.

    (amd64)

 3. The Docker daemon created a new container from that image which runs the

    executable that produces the output you are currently reading.

 4. The Docker daemon streamed that output to the Docker client, which sent it

    to your terminal.

 To try something more ambitious, you can run an Ubuntu container with:

 For more examples and ideas, visit:

 https://docs.docker.com/get-started/

Step 6: Download an image

# sudo docker pull postgres


Step 7: Verify the number of images that were pulled

# sudo docker images

REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE

postgres            latest              0f10374e5170        2 weeks ago         314MB

hello-world         latest              bf756fb1ae65        4 months ago        13.3kB


Step 8: Start an access a container

# sudo docker run postgres

# sudo docker ps -a

# sudo docker run -it postgres bash


Other Commands to know:

# sudo docker stop container_id (graceful shutdown)

# sudo docker kill container_id (non graceful shutdown)

# sudo docker rm container_id (delete a stopped container)

# sudo docker build . (build your own container)





Monday, September 21, 2020

How to Deploy and Enable Kubernetes in vSphere 7

 Requirements:

    A three node HA and DRS cluster

    A vCenter Server

    NSX already configured

    The proper license


Step 1: Using the vSphere Client, click on Menu and select Workload Menu. Click on Enable.


Step 2: Select your three node cluster and click on Next.




Step 3: Select the size of the Control Plane and click on Next.



Step 4: Specify your network settings. These appliances will have two IPs each.



Step 5: Configure your CIDRs and API Server endpoint.



Step 6: Provide the Storage related settings for the nodes and disks.


Step 7: Review your settings/values and click on Finish. 


Step 8: After clicking on Finish, walk away and wait until the procedure ends.


Step 9: Once done, you will see  a pool and three appliances created and running. 


Step 10 Next, download the kubectl utility into a windows or linux machine by using for example tools like wget. There is a .zip file that contains the software to view and control Namespaces available using the control plane node ip address (the load balancer created automatically via NSX). Just point your browser to that IP using https.

Saturday, August 29, 2020

vSAN File Services Configuration

vSAN File Services Configuration Steps

What is it?

vSAN File Services is a new feature introduced in vSAN 7.0 that allows objects to be shared via the NFS Protocol (either version 3 or 4.1). This is achieved via appliances running Photon and containers. This feature uses three appliances (will run with a minimum of two) and a maximum of 8. Each appliance uses 4vcpus and 4 or 8 GBs of RAM depending of the version. While setting this up, be aware of the Check Upgrade feature that allows the appliances to be upgraded (rolling upgrade) if new versions are available. According to Cormac Hogan a couple of days ago, 7.1 supports the SMB protocol as well as Kerberos + A.D.

Initial Steps

1. Select your vSAN Cluster, click on the Configure Tab and select Services




2. Click on Enable to the right of File Service and click on Next.



3. Load the OVF for the appliances Manually or automatically.



4. Wait for the task to conclude before clicking on Next. 



5. Specify a File Service Domain (any name, used internally only) and DNS information.


8. Specify a Port Group for the appliances and a Subnet Mask plus Gateway




9 . Specify the IP addresses of the three appliances plus their DNS names.




10. Click on Next and Finish.



What Happens Next

1. A resource pool gets created called ESX Agents with appliances get created and powered on




Create an NFS Shares

1. Select your vSAN Cluster, click on Configure and select  File Server Shares under vSAN




2. Click on Add and select a name for the Share. Add quotas and click on Next. 



3. Click on Allow Access from any IP or specify certain clients


4. Click on Finish.



5. Look at the end result.



How to Monitor the state of the Service


How to Monitor the capacity of the Share



Thursday, July 30, 2020

vSphere 7 and ADFS

How To Configure vSphere + ADFS

vSphere 7 introduces support for Active Directory Federation Services as an external identity Provider. 
The idea is to be authenticated by ADFS and NOT by SSO. 

Prerequisites:

ADFS for Windows Server 2016R2
ADFS connected to Active Directory
An Application Group for vCenter Server to be created in ADFS
An ADFS server certificate signed by a Trusted CA

1. Configure Active Directory Federation Provider by clicking on Configuration under SSO. 


2. Select the option "Change Identity Provider"


3. Configure the ADFS settings


4. Provide the Base distinguished name for users and groups plus the Primary URL. Make sure to scroll down and NOT miss the SSL Certificate section. 


5. Click on Finish.


6. Verify the settings and click on Finish.


7. Add permissions for the ADFS administrator account. Bind him to the Admin role.


8. Log into vSphere as the domain user and notice how you are redirected to your corporate page.