Kubectl get last pod or output in descending order

Get the kubectl output in descending order

Use tail and tac command in Unix because these are common commands of Unix OS.

kubectl get pods --sort-by=.metadata.creationTimestamp --no-headers | tail -r

Note: Use no header option to get the output without header and use tail command of unix with -r option to reverse the output.

We can also use tac command for same process as shown below

kubectl get pods --sort-by=.metadata.creationTimestamp --no-headers | tac

Note: tac is the reverse of the cat and is used to reverse the order of lines in the output.

Get the output of Kubectl in ascending order

Sort the output in ascending order

kubectl get pods --sort-by=.metadata.creationTimestamp

Get the most recently created POD

Using JSONPATH filtering we will get the last created pods by using -1 in items.

kubectl get pods --sort-by=.metadata.creationTimestamp -o=jsonpath='{.items[-1].metadata.name}'

Get the first one pod created or oldest pod

kubectl get pods --sort-by=.metadata.creationTimestamp -o=jsonpath='{.items[0].metadata.name}'

Installation of SQL Server 2022 Developer edition

Steps to install SQL Server 2022 Developer Edition

  1. Go to the Microsoft site for download the latest developer edition 2022:

https://www.microsoft.com/en-IN/sql-server/sql-server-downloads

2. Scroll down the page and you will find at end the developer and express edition free to download

3. Download the developer edition, it will download a download utility.

4. Double click on utility and you will have a screen to download the developer edition.

5. Go to option download media and choose the cab option for setup download in your specified folder location.

6. Download is beginning as follows:

7. Download done and close this windows and go to location of downloaded software.

8. the downloaded software look like as follow.

9. Double click on SQLServer2022 application and it will open a dialoug box for extract the software as follows:

10. Press ok and extract the software.

11. Go to the extracted folder and click on setup for installation of SQL Server database developer edition.

12. Double click on setup will open installation page for SQL Server

13. On left panel, choose the installation and from right panel, choose first option Standalone installation

14. Go for developer edition as follow and press next

15. Read the license term and go next

16. Press Next and leave microsoft update uncheck.

17. Press Next, ignore the warning for firewall.

18. Uncheck the Azure configuration, if you have you can fill the detail according to your need. I am uncheck that option as follows:

19. I choose only database engine service, if you need additional services you can choose according to your need. Press NEXT

20. You can choose named or default instance. i preferred to go with default instance as MSSQLSERVER (it is the name of instance in SQL Server).

21. Server configuration has service accounts details which service are installed on Windows machine.

22. From this screen, you have different options to choose like server configuration, data directories, tempdb setting, parallel degree Max DOP & Memory setting etc.

Choose the mixed mode to set the sa account password.

23. Ready to install screen will show the summary of choosing parameters at end. Press INSTALL if everything seems fine.

24. Installation is inprogress.

25. Complete. Your SQL Server 2022 developer edition installation completed successfully.

Note: If you don’t have SQL Server Management Studio, then you have to install again by open this software again and choose SQL Server Management Studio as follows:

Right panel 3 option: Install SQL Server Managment Tools

What is a NOLOCK Hint in SQL Server

Using the NOLOCK query optimizer hint is generally considered good practice in order to improve concurrency on a busy system. When the NOLOCK hint is included in a SELECT statement, no locks are taken when data is read. The result is a Dirty Read, which means that another process could be updating the data at the exact time you are reading it. There are no guarantees that your query will retrieve the most recent data. The advantage to performance is that your reading of data will not block updates from taking place, and updates will not block your reading of data. SELECT statements take Shared (Read) locks. This means that multiple SELECT statements are allowed simultaneous access, but other processes are blocked from modifying the data. The updates will queue until all the reads have completed, and reads requested after the update will wait for the updates to complete. The result to your system is delay(blocking).

Syntax of using NOLOCK hint:

SELECT first_name,last_name FROM dbo.employee WITH (NOLOCK)