Tuesday, March 26, 2019

Monday, March 25, 2019

virtual kubelet

Virtual Kubelet is a very interesting project.

https://github.com/virtual-kubelet/virtual-kubelet

will try this and write.

For now, you can find more info. here:
https://github.com/virtual-kubelet/virtual-kubelet/blob/master/README.md

tini - a init for containers

--

https://github.com/krallin/tini

https://github.com/krallin/tini/blob/master/README.md

--

How ?
Add Tini to your container, and make it executable. Then, just invoke Tini and pass your program and its arguments as arguments to Tini.


Why?

This will help to run Tini with PID 1 and avoid signal handling issues.


Refer the README for details.

==

Another related project is : supervisord

Ref: http://supervisord.org/

-- 

Friday, March 22, 2019

How a function changed from beginning - git trick




Come across this nice git trick  to know how a function evolved:

git log -L :<Function_name>:<Filename>


So,  it start with the first edition of the function followed by all changes done within the function.

Monday, March 18, 2019

Create docker image from running container



So, what is a docker container?

It is running(executing) docker image.

You made some changes in the docker container - maybe by yum installation / by editing some files.
You can create a new image out of this specific docker container .

How ?

// get docker id
# docker ps
<docker id>

// create new image out of the above docker container
# docker commit <docker id>  <new_name>

// check the resulting image
# docker images | grep <new_name>

Sunday, March 17, 2019

git - show the changes across commits




// show the actual changes for a file.
# git log -p <filename>

Ignoring the filename will show all the changes across commits.
# git log -p

Tuesday, March 12, 2019

Using podman in lieu of docker



--

In 2015, Docker, Red Hat, CoreOS, SUSE, Google, and other leaders in the Linux containers industry created the Open Container Initiative in order to provide an independent body to manage the standard specifications for defining container images and the runtime. In order to maintain that independence, the containers/image and containers/storage projects were created on GitHub.


https://github.com/containers/image

  image is a set of Go libraries aimed at working in various way with containers' images and container image registries.

https://github.com/containers/storage

  storage is a Go library which aims to provide methods for storing filesystem layers, container images, and containers. A containers-storage CLI wrapper is also included for manual and scripting use.

--

podman == docker

// To pull the image
podman pull fedora

image gets stored in ~/.local/share/containers/

--

Podman will default to searching through registries listed in the registries.conf file

--

// To run the image
podman run -it fedora bash

// check in another terminal
podman ps

// check the images
podman images

podman push fedora docker-daemon:fedora:latest

leaving out docker-daemon above, will push to docker hub. (which will error out).

To pull from docker's to podman

# podman pull docker-daemon:fedora:latest
--
podman useful in k8s environment:

 podman generate kube --help

NAME:

   podman generate kube - Generate Kubernetes pod YAML for a container or pod



USAGE:

   podman generate kube [command options] CONTAINER|POD-NAME



DESCRIPTION:

   Generate Kubernetes Pod YAML



OPTIONS:

   --service, -s  generate YAML for kubernetes service object

--



podman pod

NAME:

   podman pod - Manage container pods.



Pods are a group of one or more containers sharing the same network, pid and ipc namespaces.





USAGE:

   podman pod command [command options] [arguments...]



COMMANDS:

     create        Create a new empty pod

     exists        Check if a pod exists in local storage

     inspect       displays a pod configuration

     kill          Send the specified signal or SIGKILL to containers in pod

     pause         Pause one or more pods

     ps, ls, list  List pods

     restart       Restart one or more pods

     rm            Remove one or more pods

     start         Start one or more pods

     stats         Display percentage of CPU, memory, network I/O, block I/O and PIDs for containers in one or more pods

     stop          Stop one or more pods

     top           Display the running processes of containers in a pod

     unpause       Unpause one or more pods



OPTIONS:

   --help, -h  show help

--

podman build  - can build images over Dockerfile

--

Buildah can be described as a superset of commands related to creating and managing container images and, therefore, it has much finer-grained control over images. Podman’s buildcommand contains a subset of the Buildah functionality. It uses the same code as Buildah for building.

--

The most powerful way to use Buildah is to write Bash scripts for creating your images—in a similar way that you would write a Dockerfile.
--

K8s moved to CRI-O based on OCI runtime, no need for docker daemon.

no need to install docker on any host in k8s cluster.

k8s could call CRI-O and it could call runC directly.

--

buildah


  • much finer control over creating image layers.

Buildah run is not same as podman run command.

buildah run is for running specific commands in order to help build a container image

buildah run dnf -y install nginx

k8s solved runtime issue with CRI-O and runC

build problem with Buildah.

But, Docker still required. why? Debugging.

In order to avoid to install docker , use podman .

podman solves two problems -


  • operator to examine container and images with commands they are familiar with.



  • developers the same tools.




So, docker user, developer, operator all can make use of podman.

--

Source:
https://developers.redhat.com/blog/2019/02/21/podman-and-buildah-for-docker-users/


Sunday, March 3, 2019

Reclaim space in gmail - delete archive'd messages


Running out of space in Gmail?

You could check the archived messages in Gmail and delete them to get some space back.


-

gmail is by default provided with 15GB storage space (which is shared with google drive and google photos as well).

-


I have written some Gmail filters to move not so important messages to archive. Even this archive is counted towards storage space. By means of freeing up the archive, we could reclaim space.


How to get archived messages?

Search in gmail with following:
has:nouserlabels -in:Sent -in:Chat -in:Draft -in:Inbox   

This will show all archived messages.


Now, you can add more filters and delete them something like
has:nouserlabels -in:Sent -in:Chat -in:Draft -in:Inbox    from:Amazon 



Select the messages (use select all option which pops up) delete them and delete the files from "Trash" as well.


has:nouserlabels -in:Sent -in:Chat -in:Draft -in:Inbox   -in:important 


Select the messages (use select all option which pops up) delete them and delete the files from "Trash" as well.


You should be able to see the reclaimed space :)