Configuring LVM in redhat

For LVM Configuration need to follw the below steps.

1. Partition creation
2. Physical volume creation
3. Volume group creation
4. Logical volume creation

Here i’m using /dev/sda and /dev/sdb hard disks

Size:

/dev/sda – 500GB
/dev/sdb – 500GB

I already shared the steps to create partitions in previous post.

Click here to create new partition/filesystem in a physical disk.

Using fdisk we have to change the partition type by changing the ID.

For that we should use “t” option to change the partition type. Once we executed this, it will ask for
the Hex code of partition type. Here we need to mention “8e” as Hex code for LVM partition type.

Note: change the partition type for all HDD/ Partitions which we are going to configure LVM.

Than follow the below steps for LVM configuration.

Next we have to create physical volumes using below mentioned commands.

#pvcreate /dev/sda1 /dev/sdb1


#vgcreate -s 16M newvg /dev/sda1 /dev/sdb1

“newvg” is new volume group name and /dev/sda1, /dev/sdb1 will be added in this volume group.
Now this two hard disks will act as a single hard disk and the new size of hard disk is 1000GB.

Next we have to create logical volumes over the volume group, which is like a partitioning here.

#lvcreate -n lv1 -L 200G newvg

-n:  This option is to mention the new logical volume group.
lv1: new logical volume group name.
-L:  this option is to mention the size of new logical volume.

Now we have created logical volume and we should format and mount the lv.

#mkfs.xfs /dev/newvg/lv1

directory is required to mount the lv.

#mkdir /data

#mount /dev/newvg/lv1 /data


Now we successfully configured LVM. Follow the lvcreate steps to create more lv’s.



Linux kernel update


We are going to see Linux kernel update in this post.
Note: Here kernel is already upgraded one. So, we can’t show different here

Using “uname -r” command will check the current kernel version.

[root@localhost ~]# uname -r
3.10.0-514.el7.x86_64


To update the kernel use the below command.
[root@localhost ~]# yum install kernel*



Again use the uname -r command to check whether the kernel has been updated or not.
[root@localhost ~]# uname -r
3.10.0-514.el7.x86_64

Will undo the upgrade or installation using yum. For that have to check the current activity of yum using “yum history list”

We can use the ID to undo the upgrade/ installed packages.

Now am going to use ID 8 do undo the kernel upgrade

#yum history undo 8

Linux kernel update


Now use the "yum history list" command to check

Again will check whether the kernel upgrade has been removed or not.

Will use same yum option to upgrade/ undo any packages in Linux.

RHEL7 – New features

RHEL7 - New features
We are going to see RHEL7 New features in this post.
Docker    – Popular application-virtualization technology
Systemd  – Systemd was developed to replace the init system. more efficient loading of                       services during the boot process.
XFS         – it’ll support file systems of up to 500TB in size
Microsoft compatible identity management  – it’ll support file systems of up to 500TB in size
Performance co pilot – Performance tuning

Ubuntu operating system 17.04 installation

We can see How to do Ubuntu operating system 17.04 installation in this post.
Step 1 :
Boot the machine using OS media and click on “Install Ubuntu”.

Ubuntu operating system 17.04 installation

Step 2:  Now select the language and click on continue to proceed further.

Step 3:  We could see there are two check box which is mentioning here to enable the “Downloading                 updates while installation and Third party software installation” by checking this two box.

Step 4:  Now in next screen will ask for installation type. On this screen select as per your requirement. I’m going to select “Something else” option and click continue.


Step 5: Select the free space and click on “+”

Step 6:  Provide the required information to create root(/) file system and click ok.

Step 7:  Follow above step to create filesystem whatever you want and here i am create one more directory called “swap”  which doesn’t have filesystem type and it is called as virtual memory as well.

Step 8: Now you could see the created filesystem lists like below.

Step 9:  Click on “Install now” to continue with installation and click continue to confirm the changes.

Step 10: Select the time zone from next screen.

Step 11:  Than select Keyboard layout language.

Step 12:  Provide the username details which we need to create new user and which will help us to manage the system(This is not a default administrator – root) and click continue.

Step 13:  Finally files will be copied from the media to our hard disk and will ask for reboot as a final step.

Now the Ubuntu 17.04 has been installed successfully and ready to use.

Thanks for supporting.

Reference: Ubuntu Docs

Finding files in linux



“Find” command:

This will allow you to find the files/folders within a directory or recursively, that match the searching pattern whichever you are given to search.

#find .

Above command will indicate search in the current directory.

-name: This option will help you to find a file that matches the specific pattern.

And we can use metacharacters like “*”,” ” with enclosure of double quotes “”

Example:

[root@linux etc]# find . -name mtab./mtab

[root@linux /]# find /etc -name passwd/etc/passwd/etc/pam.d/passwd  -> this command will find files for starting like passwd under the /etc directory.

Using the “Locate” command:

     Locate command is faster than find command. Because it’s using a database which is previously built the database for search. Locate command will list all the path names which containing your search pattern.

The database is updated using corn or we can also manually update the database using below command.

#sudo updatedb

Example:

#locate mydata

Application deployment on Kubernetes


Deployment on Kubernetes using Kubectl.

        We can deploy containerized applications on that. To do that, we need to create Kubernetes Deployment. This deployment is responsible for the creating/ updating instance. Once deployment has been created, Kubernetes master will schedule the application instances that the deployment creates onto individual nodes in the cluster.

        Once instance are created, Kubernetes Deployment controller will monitor the application instances continuously. If the instance down or deleted, Deployment monitor will replaces it. This is called self healing, which will help to address machine failure or maintenance.

        In some other cloud technology, installation script will be used to start the applications. But, it will help on recovery from the system failure. In kubernetes will provide different approach by creating and running application instance on different nodes.

     We can create and manage deployment by using Kubernetes Command line Interface (Kubectl). Kubectl will use kubernetes API to connect with cluster.

Kubectl basics:

Downloading Kubectl:

#wget https://storage.googleapis.com/kubernetes-release/release/v1.0.1/bin/linux/amd64/kubectl

Copying kubectl to path:
#chmod +x kubectl
#mv kubectl /usr/local/bin/

Downloading
client credentials and CA cert:


gcloud compute copy-files node0:~/admin-key.pem .


gcloud compute copy-files node0:~/admin.pem .


gcloud compute copy-files node0:~/ca.pem .


Getting Kubernetes controller external IP:


EXTERNAL_IP=$(gcloud compute ssh node0 --command


  "curl -H 'Metadata-Flavor: Google'


http://metadata.google.internal/computeMetadata/v1/instance/network-interfaces/0/access-configs/0/external-ip")


Creating cluster config:


kubectl config set-cluster workshop


--certificate-authority=ca.pem


--embed-certs=true


--server=https://${EXTERNAL_IP}:6443


Adding a admin credentials:


kubectl config set-credentials admin


--client-key=admin-key.pem


--client-certificate=admin.pem


--embed-certs=true


Configuring the cluster context:


kubectl config set-context workshop


--cluster=workshop


--user=admin


kubectl config use-context workshop


kubectl config view


Explore the kubectl CLI


Checking health status of the cluster components:


kubectl get cs


List pods:


kubectl get pods


List nodes:


kubectl get nodes


List services:


kubectl get services


"Kubectl run" command will create new deployment and have to provide deployment name,


application image location and port number.




Example:
#kubectl run kubernetes-bootcamp --image=docker.io/jocatalin/kubernetes-bootcamp:v1 --port=8080


command to display the deployment:
> kubectl get deployments
NAME DESIRED CURRENT UP-TO-DATE AVAILA
BLE AGE
kubernetes-bootcamp 1 1 1 1
2m

In default case deployed applications are visible inside of kubernetes cluster, before exposing.
To view the application without exposing outside, can add route between our
terminal and kubernetes cluster using proxy.
>kubectl proxy
Started proxy enables access to the API. The applications running inside the pod.
Get the pod name and store it in the POD_NAME environment variable.


>export POD_NAME=$(kubectl get pods -o go-template –template ‘{{range .items}}{{.metadata.name}}{{“n”}}{{end}}’) echo Name of the Pod: $POD_NAME


command to see application output:

>curl http://localhost:8001/api/v1/proxy/namespaces/default/pods/$POD_NAME/



Note: Will see more application related things in future post.

About amazon EC2

  Provides scalable computing and Will reduce the Hardware investment. You can develop and deploy applications faster as you can.We can configure security, networking and storage.

Features of AWS EC2:

Virtual computing environments ( Instance)
Preconfigured templates for instance (Amazon MACHINE IMAGES)
Secure login for your instance (Amazon stores public key and you store the private key)
AMI Templates are used when launching the machine.
high memory, availability, on domain instances, reserved instance for a particular time, cost instances.

Instance types:

General purpose            –  t software development
Compute optimised         –  c High performance
Memory optimised          – r  DBs
Storage optimised           –  i or d
GPU Instances – g (Video encoding)

Launch Instance -> AMIs -> types (VCPUs) -> Storage -> NW Performance -> Additional Info (Tags)




Cluster in Kubernetes



Cluster creation using Minikube:

             It’s a opensource and will handle highly available cluster of systems that are ready to work together as connected. It will allow you to deploy containerized applications on individual systems. Containerized applications are flexible and available comparing to the old deployment methods.
               Kubernetes will automates scheduling and distributing applications across the cluster in the way of more efficient.

This cluster type consists of below resources:

1. Master – Cluster coordinator
2. Nodes – Where the applications run

Master:

Master will coordinate such as scheduling, managing, Scaling, Updating and roll out applications.
Kubernetes cluster will handle of production traffic with three nodes.

Nodes:

           This might be physical/ VM nodes where the application are running. This has kubelet agent which will help to manage and communicate with Kubernetes master server and also nodes have Docker and rkt which will help to handling the containers.

            On deployment of applications, master will schedule and start the application containers on nodes. Nodes will communicate with masters using Kubernetes API. Users also will user Kubernetes API to interact with cluster.

Kubernetes cluster can be deployed on your local or VM machines. We can use Minikube which will create a VM and implement one node cluster on your local machine. Minikube CLI will provide basic operations on your cluster like start, stop, status and delete.

To install Minikube on Linux box, we must need Virtual box/ KVM.

Minikube Installation

# curl -Lo minikube https://storage.googleapis.com/minikube/releases/v0.17.1/minikube-linux-amd64 && chmod +x minikube && sudo mv minikube /usr/local/bin/

If you are totally new to Kubernetes, you also need to download kubectl client, This is will communicate with Kubernetes API to manage containers.

Kubectl Installation:

#curl -Lo kubectl http://storage.googleapis.com/kubernetesrelease/release/v1.3.0/bin/linux/amd64/kubectl && chmod +x kubectl && sudo mv kubectl /usr/local/bin/

Note: Here I’m using Kubernetes interactive tutorials. So, required package has been already installed.

Now you were ready to use Minikube/ Kubernetes. First we must enter below command to start VM and Kubernetes cluster

#minikube start
Starting local Kubernetes cluster…
Kubectl is now configured to use the cluster.


To check the status enter below command:

#Minikube status
Running

Use the below command to check kubectl is configured or not to comminucate Minikube VM.

 # kubectl get nodes
NAME      STATUS    AGE
host01    Ready     33s


Command to check Kubectl which  command line interface version

  #kubectl version
Client Version: version.Info{Major:”1″, Minor:”5″, GitVersion:”v1.5.2″, GitCommit:”08
e099554f3c31f6e6f07b448ab3ed78d0520507″, GitTreeState:”clean”, BuildDate:”2017-01-12T
04:57:25Z”, GoVersion:”go1.7.4″, Compiler:”gc”, Platform:”linux/amd64″}
Server Version: version.Info{Major:”1″, Minor:”5″, GitVersion:”v1.5.2″, GitCommit:”08
e099554f3c31f6e6f07b448ab3ed78d0520507″, GitTreeState:”clean”, BuildDate:”1970-01-01T
00:00:00Z”, GoVersion:”go1.7.1″, Compiler:”gc”, Platform:”linux/amd64″}


Use the below command to view the cluster details:

#kubectl cluster-info
Kubernetes master is running at http://host01:8080
heapster is running at http://host01:8080/api/v1/proxy/namespaces/kube-system/service
s/heapster
kubernetes-dashboard is running at http://host01:8080/api/v1/proxy/namespaces/kube-sy
stem/services/kubernetes-dashboard
monitoring-grafana is running at http://host01:8080/api/v1/proxy/namespaces/kube-syst
em/services/monitoring-grafana
monitoring-influxdb is running at http://host01:8080/api/v1/proxy/namespaces/kube-sys
tem/services/monitoring-influxdb

To further debug and diagnose cluster problems, use ‘kubectl cluster-info dump’.

To view the nodes in the cluster:

#kubectl get nodes
NAME      STATUS    AGE
host01    Ready     2m



           

Introduction to kubernetes

                 Using this will automate the deployment, scaling, management of containerized applications and etc.
             
                It will create containers which will help to easy management and discovering applications as logical units.

                As its a cloud system, it can be accessible from anywhere. It will support on-premise, hybrid and public cloud infrastructure. It will reduce ops count for operations.

Features:

Automatic binpacking
Self-healing
Horizontal scaling
Service discovery and load balancing
Automated rollouts and rollbacks
Secret and configuration management
Storage orchestration
Batch execution

         We will help you to know the basic of kubernetes cluster system with background, concepts of kubernetes, Deploy a containerized application, Scale the deployment, Update and debug the applications.

Modules of Kubernetes:

1. Create a kubernetes cluster
2. Deploy a application
3. Explore your application
4. Explore your application publicly
5. Scale up your application
6. Update your application

Configuring syslogd in linux

Will see Configuring syslogd in Linux in this post

Follow the below steps on server:

Required services for syslogd

1. portmap
2 xinetd
3. syslog

Run the below command to keep on running above mentioned service after server reboot

#chkconfig portmap on
#chkconfig xinetd on
#chkconfig syslog on

Start portmap and xinetd services

#service portmap start
#service xinetd start

Check the service status

#service portmap status
#service xinetd status

Now edit “/etc/sysconfig/syslog” file using vi editor

#vi /etc/sysconfig/syslog

find for SYSLOGD_OPTIONS=”-m 0″

and add -r option to accept the logs from system

SYSLOGD_OPTIONS=”-r -m 0″

save and quit from the file :wq

-x disable DNS lookups on messages with -r option
-m 0 disabled MARK messages
-r enables logging

Once edited the file restart the syslog service

#service syslog retsrat

Follow the steps on client

Edit /etc/syslog.conf file and add a entry at end of file for server as shown below.

:Lets assume server ip as 192.168.1.10

#vi /etc/syslog.conf
user.* @192.168.1.10

Save and quit from the file :wq

now restart the syslog service on client

#service syslog restart

Now restart the client and check log entry in server. it will generate logs in server.

Checking logs on server

#less /var/log/messages

end of this log file you can see the recent logs.