Skip to main content

Logical Volume Manager

LVM Commands
###########


>> First we need to create Physical Volume. PV is chunks of 4MBs
>> Then create Volume Group using this PV.
>> THen create Logical Volume.

Creating PV:

[root@localhost ~]# pvcreate /dev/vdb5 /dev/vdc1 /dev/vdb6 /dev/vdc2
  Physical volume "/dev/vdb5" successfully created.
  Physical volume "/dev/vdc1" successfully created.
  Physical volume "/dev/vdb6" successfully created.
  Physical volume "/dev/vdc2" successfully created.


pvdisplay

  --- NEW Physical volume ---
  PV Name               /dev/vdc1
  VG Name              
  PV Size               2.00 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               gDI14y-m6Af-DAek-0xdv-bZEs-4wVd-GJcH68
  
  "/dev/vdb5" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vdb5
  VG Name              
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               NrBHJ6-JVBz-Z6UI-jpBi-OS9A-elWq-M5Ndnu
  
  "/dev/vdc2" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vdc2
  VG Name              
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               le8iAi-wADA-QKGx-nUU8-NC5v-U8ts-cgBNsK
  
  "/dev/vdb6" is a new physical volume of "1.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/vdb6
  VG Name              
  PV Size               1.00 GiB
  Allocatable           NO
  PE Size               0  
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               1BVXOS-Ws83-HC4d-Jmmh-rw5d-VnuS-cwj2HK


Volume Group Creation:
######################

vgcreate

[root@localhost ~]# vgcreate -v myvg-group /dev/vdb5 /dev/vdc1
    Wiping internal VG cache
    Wiping cache of LVM-capable devices
    Wiping signatures on new PV /dev/vdb5.
    Wiping signatures on new PV /dev/vdc1.
    Adding physical volume '/dev/vdb5' to volume group 'myvg-group'
    Adding physical volume '/dev/vdc1' to volume group 'myvg-group'
    Archiving volume group "myvg-group" metadata (seqno 0).
    Creating volume group backup "/etc/lvm/backup/myvg-group" (seqno 1).
  Volume group "myvg-group" successfully created


[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               myvg-group
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              766
  Alloc PE / Size       0 / 0  
  Free  PE / Size       766 / 2.99 GiB
  VG UUID               B2bMFI-covb-RpUc-I3U9-FI08-T7ym-FGfOBn
  
  --- Volume group ---
  VG Name               cl
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               19.00 GiB
  PE Size               4.00 MiB
  Total PE              4863
  Alloc PE / Size       4863 / 19.00 GiB
  Free  PE / Size       0 / 0  
  VG UUID               JPKYIf-gxbw-CV72-sOK0-dc4e-Zy9Y-jCZcdj
 
 
 
  Creating the Logical Volume
  ############################
 
  [root@localhost ~]# lvcreate -L 1.5G -n myLV1 myvg-group
  Logical volume "myLV1" created.

  Viewing the Logical Volume
  ##########################
 
  root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/myvg-group/myLV1
  LV Name                myLV1
  VG Name                myvg-group
  LV UUID                xQZu1c-tQ0S-jlYo-Dquz-16VY-HuIQ-xOcucI
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-21 03:14:01 -0400
  LV Status              available
  # open                 0
  LV Size                1.50 GiB
  Current LE             384
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2
  
  --- Logical volume ---
  LV Path                /dev/cl/swap
  LV Name                swap
  VG Name                cl
  LV UUID                3TzTXH-7jCc-akY7-ZT9V-VZsi-Sc8L-q8A2zt
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-19 06:13:30 -0400
  LV Status              available
  # open                 2
  LV Size                2.00 GiB
  Current LE             512
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1
  
  --- Logical volume ---
  LV Path                /dev/cl/root
  LV Name                root
  VG Name                cl
  LV UUID                us1RfD-IlME-Kg5F-RWed-Z0Cc-LgDC-ucLdVP
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-19 06:13:30 -0400
  LV Status              available
  # open                 1
  LV Size                17.00 GiB
  Current LE             4351
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

 
 
 
[root@localhost ~]# mkfs.ext4 /dev/myvg-group/myLV1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
98304 inodes, 393216 blocks
19660 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=402653184
12 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912

Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
 
 
 
  LV extending
  ############
 
[root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               myvg-group
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               2.99 GiB
  PE Size               4.00 MiB
  Total PE              766
  Alloc PE / Size       384 / 1.50 GiB
  Free  PE / Size       382 / 1.49 GiB
  VG UUID               B2bMFI-covb-RpUc-I3U9-FI08-T7ym-FGfOBn

 
lvextend -L +1.49G /dev/myvg-group/myLV1
 
[root@localhost ~]# lvextend -L +1.49G /dev/myvg-group/myLV1
  Rounding size to boundary between physical extents: 1.49 GiB.
  Size of logical volume myvg-group/myLV1 changed from 1.50 GiB (384 extents) to 2.99 GiB (766 extents).
  Logical volume myvg-group/myLV1 successfully resized.

mkfs of resized LV
##################
 
  [root@localhost ~]# resize2fs /dev/myvg-group/myLV1
resize2fs 1.42.9 (28-Dec-2013)
Filesystem at /dev/myvg-group/myLV1 is mounted on /mnt; on-line resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/myvg-group/myLV1 is now 784384 blocks long.


[root@localhost ~]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/cl-root             17G  951M   17G   6% /
devtmpfs                       234M     0  234M   0% /dev
tmpfs                          245M     0  245M   0% /dev/shm
tmpfs                          245M  4.4M  240M   2% /run
tmpfs                          245M     0  245M   0% /sys/fs/cgroup
/dev/vda1                     1014M  138M  877M  14% /boot
tmpfs                           49M     0   49M   0% /run/user/0
/dev/mapper/myvg--group-myLV1  3.0G  4.5M  2.8G   1% /mnt


Now the LV is increased to 3GB from 1.5 GB


Now there is no space in the VG:

Now if we need to increase the space of the LV..We need to first extent the VG


  Physical volume "/dev/vdb6" successfully created.
 

[root@localhost ~]# vgextend myvg-group /dev/vdb6
  Volume group "myvg-group" successfully extended


root@localhost ~]# vgdisplay
  --- Volume group ---
  VG Name               myvg-group
  System ID            
  Format                lvm2
  Metadata Areas        3
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               1
  Max PV                0
  Cur PV                3
  Act PV                3
  VG Size               3.99 GiB
  PE Size               4.00 MiB
  Total PE              1021
  Alloc PE / Size       766 / 2.99 GiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               B2bMFI-covb-RpUc-I3U9-FI08-T7ym-FGfOBn
  
  --- Volume group ---
  VG Name               cl
  System ID            
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  3
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               19.00 GiB
  PE Size               4.00 MiB
  Total PE              4863
  Alloc PE / Size       4863 / 19.00 GiB
  Free  PE / Size       0 / 0  
  VG UUID               JPKYIf-gxbw-CV72-sOK0-dc4e-Zy9Y-jCZcdj

 
 
[root@localhost ~]# lvextend -L +1020M /dev/myvg-group/myLV1
  Size of logical volume myvg-group/myLV1 changed from 2.99 GiB (766 extents) to 3.99 GiB (1021 extents).
  Logical volume myvg-group/myLV1 successfully resized.
 
[root@localhost ~]# lvdisplay
  --- Logical volume ---
  LV Path                /dev/myvg-group/myLV1
  LV Name                myLV1
  VG Name                myvg-group
  LV UUID                xQZu1c-tQ0S-jlYo-Dquz-16VY-HuIQ-xOcucI
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-21 03:14:01 -0400
  LV Status              available
  # open                 1
  LV Size                3.99 GiB
  Current LE             1021
  Segments               3
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

 
  Physical volume "/dev/vdc2" successfully created.
 
Now we are going to extend the / root VG ie 'cl'
 
[root@localhost ~]# vgextend cl /dev/vdc2
  Volume group "cl" successfully extended

    
  --- Volume group ---
  VG Name               cl
  System ID            
  Format                lvm2
  Metadata Areas        2
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                2
  Open LV               2
  Max PV                0
  Cur PV                2
  Act PV                2
  VG Size               19.99 GiB
  PE Size               4.00 MiB
  Total PE              5118
  Alloc PE / Size       4863 / 19.00 GiB
  Free  PE / Size       255 / 1020.00 MiB
  VG UUID               JPKYIf-gxbw-CV72-sOK0-dc4e-Zy9Y-jCZcdj
 
  Now check the filesystem of cl VG
 
  cat /etc/fstab | grep cl-root
 
  [root@localhost ~]# cat /etc/fstab | grep cl-root
/dev/mapper/cl-root     /                       xfs     defaults        0 0

 
its xfs.

Now extent the LV

 --- Logical volume ---
  LV Path                /dev/cl/root
  LV Name                root
  VG Name                cl
  LV UUID                us1RfD-IlME-Kg5F-RWed-Z0Cc-LgDC-ucLdVP
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2017-10-19 06:13:30 -0400
  LV Status              available
  # open                 1
  LV Size                17.99 GiB
  Current LE             4606
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0


[root@localhost ~]# lvextend -L +1020M /dev/cl/root
  Size of logical volume cl/root changed from 17.00 GiB (4351 extents) to 17.99 GiB (4606 extents).
  Logical volume cl/root successfully resized.
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# xfs_growfs /dev/cl/root
meta-data=/dev/mapper/cl-root    isize=512    agcount=4, agsize=1113856 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0 spinodes=0
data     =                       bsize=4096   blocks=4455424, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal               bsize=4096   blocks=2560, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
data blocks changed from 4455424 to 4716544
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/cl-root             18G  951M   18G   6% /
devtmpfs                       234M     0  234M   0% /dev
tmpfs                          245M     0  245M   0% /dev/shm
tmpfs                          245M  4.4M  240M   2% /run
tmpfs                          245M     0  245M   0% /sys/fs/cgroup
/dev/vda1                     1014M  138M  877M  14% /boot
tmpfs                           49M     0   49M   0% /run/user/0
/dev/mapper/myvg--group-myLV1  3.0G  4.5M  2.8G   1% /mnt
[root@localhost ~]#

 
  To reduce the created LV
  #########################
 
  [root@localhost ~]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/cl-root             18G  951M   18G   6% /
devtmpfs                       234M     0  234M   0% /dev
tmpfs                          245M     0  245M   0% /dev/shm
tmpfs                          245M  4.4M  240M   2% /run
tmpfs                          245M     0  245M   0% /sys/fs/cgroup
/dev/vda1                     1014M  138M  877M  14% /boot
tmpfs                           49M     0   49M   0% /run/user/0
/dev/mapper/myvg--group-myLV1  3.0G  4.5M  2.8G   1% /mnt
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# umount /dev/mapper/myvg--group-myLV1
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem           Size  Used Avail Use% Mounted on
/dev/mapper/cl-root   18G  951M   18G   6% /
devtmpfs             234M     0  234M   0% /dev
tmpfs                245M     0  245M   0% /dev/shm
tmpfs                245M  4.4M  240M   2% /run
tmpfs                245M     0  245M   0% /sys/fs/cgroup
/dev/vda1           1014M  138M  877M  14% /boot
tmpfs                 49M     0   49M   0% /run/user/0
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# e2fsck -f /dev/myvg-group/myLV1
e2fsck 1.42.9 (28-Dec-2013)
Pass 1: Checking inodes, blocks, and sizes
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
Pass 4: Checking reference counts
Pass 5: Checking group summary information
/dev/myvg-group/myLV1: 11/196608 files (9.1% non-contiguous), 21692/784384 blocks

[root@localhost ~]# resize2fs /dev/myvg-group/myLV1 2G
resize2fs 1.42.9 (28-Dec-2013)
Resizing the filesystem on /dev/myvg-group/myLV1 to 524288 (4k) blocks.
The filesystem on /dev/myvg-group/myLV1 is now 524288 blocks long.

[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# lvreduce -L 2G /dev/myvg-group/myLV1
  WARNING: Reducing active logical volume to 2.00 GiB.
  THIS MAY DESTROY YOUR DATA (filesystem etc.)
Do you really want to reduce myvg-group/myLV1? [y/n]: y
  Size of logical volume myvg-group/myLV1 changed from 3.99 GiB (1021 extents) to 2.00 GiB (512 extents).
  Logical volume myvg-group/myLV1 successfully resized.

 
  [root@localhost ~]# mount /dev/myvg-group/myLV1 /mnt
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# df -h
Filesystem                     Size  Used Avail Use% Mounted on
/dev/mapper/cl-root             18G  951M   18G   6% /
devtmpfs                       234M     0  234M   0% /dev
tmpfs                          245M     0  245M   0% /dev/shm
tmpfs                          245M  4.4M  240M   2% /run
tmpfs                          245M     0  245M   0% /sys/fs/cgroup
/dev/vda1                     1014M  138M  877M  14% /boot
tmpfs                           49M     0   49M   0% /run/user/0
/dev/mapper/myvg--group-myLV1  2.0G  4.5M  1.9G   1% /mnt


[root@localhost ~]# lvscan
  ACTIVE            '/dev/myvg-group/myLV1' [2.00 GiB] inherit
  ACTIVE            '/dev/cl/swap' [2.00 GiB] inherit
  ACTIVE            '/dev/cl/root' [17.99 GiB] inherit
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vgscan
  Reading volume groups from cache.
  Found volume group "myvg-group" using metadata type lvm2
  Found volume group "cl" using metadata type lvm2
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# pvscan
  PV /dev/vdb5   VG myvg-group      lvm2 [1020.00 MiB / 1016.00 MiB free]
  PV /dev/vdc1   VG myvg-group      lvm2 [2.00 GiB / 0    free]
  PV /dev/vdb6   VG myvg-group      lvm2 [1020.00 MiB / 1020.00 MiB free]
  PV /dev/vda2   VG cl              lvm2 [19.00 GiB / 0    free]
  PV /dev/vdc2   VG cl              lvm2 [1020.00 MiB / 0    free]
  Total: 5 [23.98 GiB] / in use: 5 [23.98 GiB] / in no VG: 0 [0   ]

 
  [root@localhost ~]# lvremove /dev/myvg-group/myLV1
Do you really want to remove active logical volume myvg-group/myLV1? [y/n]: y
  Logical volume "myLV1" successfully removed
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vgscan
  Reading volume groups from cache.
  Found volume group "myvg-group" using metadata type lvm2
  Found volume group "cl" using metadata type lvm2
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]#
[root@localhost ~]# vgremove /dev/myvg-group
  Volume group "myvg-group" successfully removed

[root@localhost ~]#
[root@localhost ~]# pvremove /dev/vdb5 /dev/vdc1 /dev/vdb6
  Labels on physical volume "/dev/vdb5" successfully wiped.
  Labels on physical volume "/dev/vdc1" successfully wiped.
  Labels on physical volume "/dev/vdb6" successfully wiped.
 

 
Commands
########

   10  fdisk -l
   11  fdisk /dev/vdb
   12  partprobe /dev/vdb
   13  mkfs.ext4 /dev/vdb1
   14  mount /dev/vdb1 /mnt/
   15  cd
   16  umount /mnt/
   17  fdisk -
   18  fdisk -l
   19  fdisk /dev/vdb
   20  partprobe /dev/vdb
   21  fdisk -l
   22  free -m
   23  poweroff
   24  passwd
   25  sed -i 's/192.168.10.181/192.168.10.188/g' /etc/sysconfig/network-scripts/ifcfg-eth0
   26  poweroff
   27  hostname -i
   28  ifconfig | grep inet
   29  ip -a
   30  cat /etc/hosts
   31  cat /etc/sysconfig/network
   32  w
   33  ps aux | grep pts/0
   34  w
   35  fdisk -l
   36  fdisk -l | grep disk
   37  fdisk -l | grep -i disk
   38  fdisk -l
   40  fdisk /dev/vda1
   42  fdisk -l
   43  fdisk /dev/vdb
   44  fdisk -l
   45  fdisk /dev/vdb
   46  partprobe
   48  fdisk -l /dev/vdb
   49  mkfs.ext4 /dev/vbd1
   50  mkfs.ext4 /dev/vdb1
   51  fdisk -l
   52  mkfs.ext4 /dev/vdb2
   53  mkfs.ext4 /dev/vdb3
   54  fdisk -l
   55  mount /dev/vdb1 /mnt
   57  mount
   58  cd /mnt
   59  touch jino
   60  cd
   61  fdisk /mnt/jino
   62  fdisk -l /mnt/jino
   64  vi /etc/fstab
   65  cat /etc/fstab
   66  mount -a
   68  fdisk -l
   69  fdisk /dev/vdc
   70  partprobe /dev/vdc
   72  fdisk -l
   73  fdisk /dev/vdb
   74  partprobe /dev/vdb
   76  fdisk -l
   77  pvcreate /dev/vdb5 /dev/vdc1 /dev/vdb6 /dev/vdc2
   78  pvdisplay
   79  vgcreate -v myvg-group /dev/vdb5 /dev/vdc1
   80  vgdisplay
   81  lvcreate -L 1.5G -n myLV1 myvg-group
   82  lvdisplay
   83  mkfs.ext4 /dev/myvg-group/myLV1
   84  mount /dev/myvg-group/myLV1
   85  #mount /dev/myvg-group/myLV1
   87  umount /dev/vdb1
   88  mount /dev/myvg-group/myLV1 /mnt
   90  lvdisplay
   91  vgdisplay
   93  lvdisplay
   94  vgdisplay
   95  lvextend -L +1.49G /dev/myvg-group/myLV1
   96  resize2fs /dev/myvg-group/myLV1
   98  fdisk -l
   99  vgextent myvg-group /dev/vdb6
  100  vgextend myvg-group /dev/vdb6
  101  vgdisplay
  102  lvextend -L +1020M /dev/myvg-group/myLV1
  104  lvdisplay
  105  fdisk -l
  106  pvdisplay
  107  vgextend cl /dev/vdc2
  108  vgdisplay
  109  cat /etc/fstab | grep cl-root
  110  lvdisplay
  111  lvextend -L +1020M /dev/cl/root
  112  xfs_growfs /dev/cl/root
  114  lvdisplay
  116  umount /dev/mapper/myvg--group-myLV1
  118  e2fsck -f /dev/myvg-group/myLV1
  119  resize2fs /dev/myvg-group/myLV1 2G
  120  lvreduce -L 2G /dev/myvg-group/myLV1
  122  mount /dev/myvg-group/myLV1
  123  mount /dev/myvg-group/myLV1 /mnt
  125  lvdisplay
  126  vgdisplay
  129  history
  132  lvscan
  133  vgscan
  134  pvscan
  136  umount /dev/myvg-group/myLV1
  138  lvscan
  139  lvremove /dev/myvg-group/myLV1
  140  vgscan
  141  vgremove /dev/myvg-group
  142  pvremove /dev/vdb5 /dev/vdc1 /dev/vdb6

Comments

Popular posts from this blog

K8s External Secrets integration between AWS EKS and Secrets Manager(SM) using IAM Role.

What is K8s External Secrets and how it will make your life easier? Before saying about External Secrets we will say about k8s secrets and how it will work. In k8s secrets we will create key value pairs of the secrets and set this as either pod env variables or mount them as volumes to pods. For more details about k8s secrets you can check my blog http://jinojoseph.blogspot.com/2020/08/k8s-secrets-explained.html   So in this case if developers wants to change the ENV variables , then we have to edit the k8s manifest yaml file, then we have to apply the new files to the deployment. This is a tiresome process and also chances of applying to the wrong context is high if you have multiple k8s clusters for dev / stage and Prod deployments. So in-order to make this easy , we can add all the secrets that is needed in the deployment, in the AWS Secret Manager and with the help of External secrets we can fetch and create those secrets in the k8s cluster. So what is K8s external Secret? It i...

Password reset too simplistic/systematic issue

Some time when we try to reset the password of our user in linux it will show as simple and systematic as below: BAD PASSWORD: it is too simplistic/systematic no matter how hard password you give it will show the same. Solution: ######### Check if your password is Ok with the below command, jino@ndz~$ echo 'D7y8HK#56r89lj&8*&^%&^%#56rlKJ!789l' | cracklib-check D7y8HK#56r89lj&8*&^%&^%#56rlKJ!789l: it is too simplistic/systematic Now Create a password with the below command : jino@ndz~$ echo $(tr -dc '[:graph:]' 7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K; You can see that this password will be ok with the cracklib-check. jino@ndz~$ echo '7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K;' | cracklib-check                 7\xi%!W[y*S}g-H7W~gbEB4cv,9:E:K;: OK Thats all, Thanks.

Setting /etc/hosts entries during the initial deployment of an Application using k8s yaml file

Some times we have to enter specific hosts file entries to the container running inside the POD of a kubernetes deployment during the initial deployment stage itself. If these entries are not in place, the application env variables mentioned in the yaml file , as hostnames , will not resolve to the IP address and the application will not start properly. So to make sure the /etc/hosts file entries are already there after the spin up of the POD you can add the below entries in your yaml file. cat > api-deployment.yaml apiVersion: apps/v1 kind: Deployment metadata: spec:   template:     metadata:     spec:       volumes:       containers:       - image: registryserver.jinojoseph.com:5000/jinojosephimage:v1.13         lifecycle:           postStart:             exec:               command:...