Saturday, 29 January 2022

KUBERNETES - How to enable autocompletion Kubernetes commands

In order to perform autocompletion of Kubernetes commands




  • First check the shell - echo $SHELL




  • Install the package:-  apt-get install bash-completion 

Now try typing the command kubectl and press tab, it will auto-complete.


Recommended Books:-


Mastering Kubernetes: Level up your container orchestration skills with Kubernetes to build, run, secure, and observe large-scale distributed apps, 3rd Edition Paperback







 

KUBERNETES - The kubernetes nodes were reporting in not ready state after restart of ubuntu worker nodes

Kubernetes - The kubernetes nodes were reporting in not ready state after restart of ubuntu worker nodes.


Today after restarting the worker nodes (ubuntu2 and ubuntu3) they were showing in not-ready state.




In order to solve the issue I ran the command:- sudo  swapoff -a on the worker node - ubuntu2



After running the command, I checked the status of the nodes on the master node - ubuntu1



Please note that the  node - ubuntu2 shows in ready state where as node - ubuntu3 is in not ready state.

Now I will run the command - sudo swapoff -a command on the worder node to disable the swap on it.



Now if we check the status of the nodes from the master node:- ubuntu1, both the nodes are in ready state.


KUBERNETES - The connection to the server 192.168.181.11:6443 was refused - did you specify the right host or port?

Today when I started by Kubernetes setup (ubuntu1-master node) and ran the command kubectl get nodes I received the below error:-


Error:- The connection to the server 192.168.181.11:6443 was refused - did you specify the right host or port?




In order to solve the issue I ran the below commands on the master node:-

Sunday, 16 January 2022

ANSIBLE - HOW TO DELETE FOLDER FROM REMOTE SERVERS

How to delete folder from Remote Servers

I have created 3 Ubuntu servers with the names:-

Server1 - Installed Ansible

Server2 - Client Node1

Server3- Client Node2

Note:- I installed ansible on Server1.

I have created a file :- vi remove-dir.yml

This will delete the folder /oracle from the app group [Server2 and Server3]


Recommended Books:-

Implementing DevOps with Ansible 2 Paperback

Automation with Ansible Paperback

Ansible for DevOps: Server and configuration management for humans

Ansible: From Beginner to Pro Paperback

Ansible: Up and Running- Automating Configuration Management and Deployment the Easy Way Paperback


ANSIBLE - HOW TO GET THE DISK DETAILS FROM REMOTE SERVERS

 How to get the disk details from Remote Servers

I have created 3 Ubuntu servers with the names:-

Server1 - Installed Ansible

Server2 - Client Node1

Server3- Client Node2

Note:- I installed ansible on Server1.

I have created a file :- vi disk-details.yml

This will gather the disk details from the app group [Server2 and Server3]


Print the disk space details from the servers



ANSIBLE - HOW TO CREATE A FOLDER AND CREATE A FILE NAMED WELCOME USING ANSIBLE FILE/COPY MODULE

How to create a folder using Ansible File Module and create a file named welcome

I have created 3 Ubuntu servers with the names:-

Server1 - Installed Ansible

Server2 - Client Node1

Server3- Client Node2

Note:- I installed ansible on Server1.

I have created a file :- vi create-file.yml

This will create the directory oracle on the / partition and welcome file under it 

for app group [Server2 and Server3]




Now we will run the playbook with the command:- ansible-playbook create-file.yml



The above task has been completed successfully. We can validate the folder and file creation.
 
Server2




Server3



ANSIBLE - HOW TO RUN THE ANSIBLE PLAYBOOK IN SIMULATION MODE

How to run the ansible playbook in Simulation Mode.

In order to run the playbook in simulation mode, we can run the command - ansible-playbook  -C [Name of the playbook].

In my example, I am running it for the playbook - create-dir-oracle.yml


Recommended Books:-

Implementing DevOps with Ansible 2 Paperback

Automation with Ansible Paperback

Ansible for DevOps: Server and configuration management for humans

Ansible: From Beginner to Pro Paperback

Ansible: Up and Running- Automating Configuration Management and Deployment the Easy Way Paperback