Skip to main content

Posts

Updating the Jenkins Version

Common location of jenkins war file on ubuntu server is: cd /usr/share/jenkins/ Stop the jenkins server $ sudo service jenkins stop Move existing jenkins war file $ sudo mv jenkins.war jenkins.war.old Download latest/specific jenkins war file $ sudo wget https://updates.jenkins-ci.org/latest/jenkins.war # For latest $ sudo wget https://updates.jenkins-ci.org/download/war/2.222.4/jenkins.war # for 2.222.4 Start the Jenkins server $ sudo service jenkins start

Grok pattern for custome java log

Grok pattern for the below log. 27-05-2020 06:44:33.476 [app-api-5bd9d99b8-sjql5-6f5bdf4a-f2c9-4a25-8fe6-031e9fa28cf0] DEBUG 1 [http-nio-8080-exec-4] c.w.w.m.customer.controllers.CustomerController [get-141] : Get all Customer request received. This has to be added in the logstash config file /usr/share/logstash/pipeline/logstash.conf filter {       grok {         match => { "message" => ["%{DATE_EU:date} %{TIME:logTime} *\[%{DATA:requestId}] %{LOGLEVEL:logLevel} %{NUMBER:processId} *\[%{DATA:threadName}] %{JAVACLASS:className} *\[%{DATA:origin}] :%{GREEDYDATA:message}"] }       } } alternative grok pattern ##################### (? %{MONTHDAY}-%{MONTHNUM}-%{YEAR} %{HOUR}:%{MINUTE}:%{SECOND}.%{NONNEGINT}) *\[%{DATA:requestId}] %{LOGLEVEL:logLevel} %{NUMBER:processId} *\[%{DATA:threadName}] %{JAVACLASS:className} *\[%{DATA:origin}] :%{GREEDYDATA:messagebody} Example logstash file with grok pattern for parsing ...

ELK Stack with Filebeat using Docker Containers

ubuntu@master:~$ git clone https://github.com/deviantony/docker-elk.git ubuntu@master:~$ cd docker-elk ubuntu@master:~/docker-elk$ sudo docker-compose up -d Creating dockerelk_elasticsearch_1 ... done WARNING: Image for service kibana was built because it did not already exist. To rebuild this image you must use `docker-compose build` or `docker-compose up --build`. Creating dockerelk_elasticsearch_1 ... Creating dockerelk_logstash_1      ... done Creating dockerelk_kibana_1        ... done ubuntu@master:~/docker-elk$ sudo docker-compose ps           Name                         Command               State                                   Ports                      ...

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:...

Docker & K8S Errors & Fixes.

Error 1 ###### root@ndz-Lenovo-ideapad-320-15ISK ~ # docker-compose --version Traceback (most recent call last):   File "/usr/bin/docker-compose", line 9, in     load_entry_point('docker-compose==1.8.0', 'console_scripts', 'docker-compose')()   File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 542, in load_entry_point     return get_distribution(dist).load_entry_point(group, name)   File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2569, in load_entry_point     return ep.load()   File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2229, in load     return self.resolve()   File "/usr/lib/python2.7/dist-packages/requests/compat.py", line 42, in     from .packages.urllib3.packages.ordered_dict import OrderedDict ImportError: No module named ordered_dict Fix ### pip uninstall urllib3 pip install urllib3 ...

Running same command in multiple terminal windows simultaneously (tmux)

You need to install the tool tmux (Terminal Multiplexer). # sudo apt-get update # sudo apt-get install tmux now u can give the command tmux from the terminal. This will open a tmux session . ######################################### Now inside this session u need to login to your first server. ######################################### Now click on the Ctrl + b + " This will split the screen up and down. You need to login to your second server in the second screen. ######################################### Now Enable synchronize-panes by pressing ctrl+b followed by shift+: Next type: "set synchronize-panes on" at the prompt. ######################################### To disable synchronization: set synchronize-panes off Finally  Ctrl + d ,for exiting from the tmux session. check this   link   for more options

How to Remove and add a Node from a K8S cluster.

First login to the Control-plane node where you can list the nodes. 1) Drain the node (Remove from cluster) # kubectl drain <node name> You might have to ignore daemonsets and local-data in the machine # kubectl drain --ignore-daemonsets --delete-local-data 2) Now delete the node # kubectl delete node <node name> Now if you want to add the node again, you might want to re-generate the token of kubeadm join command for adding the worker. Always use the --v=5 along with the kubeadm join command which will show the error description. # kubeadm token create Now use this token for the kubeadm join command , so that you can join the worker node.