Monday, June 17, 2019

AnsibleError: Unable to create local directories(/home/ubuntu/.ansible/tmp)


Ansible Error: 

AnsibleError: Unable to create local directories(/home/ubuntu/.ansible/tmp): [Errno 13] Permission denied: '/home/ubuntu/.ansible/tmp'

When I do ls -al I see the .ansible directory is owned by root. 

drwx------  3 root   root       4096 Jun 14 09:09 .ansible

So either run Ansible using sudo 
 OR 
Change permissions of this directory to allow the logged in user to create files. 

ERROR! Unexpected Exception, this is probably a bug: 'PlaybookCLI' object has no attribute 'options


Error when running Ansible Playbook 

ERROR! Unexpected Exception, this is probably a bug: 'PlaybookCLI' object has no attribute 'options

Haven't been able to solve it yet. Looks like some Ansible version compatability. 

Friday, June 14, 2019

POD showing status Init:ImagePullBackOff

I'm trying to install Redis using Helm... It goes through all the steps fine but when I try to see the POD's I see the status as Init:ImagePullBackOff. 
Not sure what this really is. Have you come across such status for PODS? 

ubuntu@ip-10-0-64-140:~/$ kubectl get po --namespace platform-svcs
NAME                                         READY     STATUS                         RESTARTS   AGE
session-store-redis-ha-server-0   0/2           Init:ImagePullBackOff   0                  17s
ubuntu@ip-10-0-64-140:~/$ 


Used the following command to get to events: 

kubectl describe pod session-store-redis-ha-server-0 --namespace platform-svcs


This pointed me to the problem that I do not have access to the repo having Redis image. 

Friday, August 3, 2018

error: the server doesn't have resource type “svc”


ere is what I did to work it through.... 1. Enabled verbose to make sure config files are read properly.
kubectl get svc --v=10
  1. Modified the file as below:

apiVersion: v1
clusters:
- cluster:
    server: XXXXXXXXXXXXX
    certificate-authority-data: XXXXXXXXXX
  name: my-eks
contexts:
- context:
    cluster: my-eks
    user: aws
  name: aws
current-context: aws
kind: Config
preferences: {}
users:
- name: aws
  user:
    exec:
      apiVersion: client.authentication.k8s.io/v1alpha1
      command: aws-iam-authenticator
      args:
        - "token"
        - "-i"
        - "my-eks"
        # - "-r"
        # - "<role-arn>"
      env:
        - name: AWS_PROFILE
          value: "aws"

Sunday, May 20, 2018

How to run two container websites on a single port in Docker?


There is no out of  the box solution for this because it is not a valid design using dockers. However you can go about installing & configuring a reverse proxy which sits in front of your docker containers.

See this article for details on configuring ngnix as a reverse proxy for docker containers https://www.thepolyglotdeveloper.com/2017/03/nginx-reverse-proxy-containerized-docker-applications/

How to manage files & space in Docker


There are three main ways docker stores files:

  • By default, everything you save to disk inside the container is saved in the aufs layer. This doesn’t create problems if you clean up unused containers and images.
  • If you mount a file or directory from the host (using docker run -v /host/path:/container/path …) the files are stored in the host filesystem, so it’s easy to track them and there is no problem also.
  • The third way are docker volumes. Those are special paths that are mapped to a special directory in /var/lib/docker/volumes/ path on the host. A lot of images use volumes to share files between containers (using the volumes-from option) or persist data so you won’t lose them after the process exits (the data-only containers pattern).

Since there is no tool to list volumes and their state, it’s easy to leave them on disk even after all processes exited and all containers are removed.

You can use below script to cleanup all the things: 

#!/bin/bash


# remove exited containers:

docker ps --filter status=dead --filter status=exited -aq | xargs -r docker rm -v


# remove unused images:

docker images --no-trunc | grep '<none>' | awk '{ print $3 }' | xargs -r docker rmi


# remove unused volumes:

find '/var/lib/docker/volumes/' -mindepth 1 -maxdepth 1 -type d | grep -vFf <(

docker ps -aq | xargs docker inspect | jq -r '.[] | .Mounts | .[] | .Name | select(.)'

) | xargs -r rm -fr

Friday, October 20, 2017

org.hibernate.HibernateException: Error accessing stax stream

Couple of things you should check: 
  • If you are using Eclipse IDE make sure that it is not giving you any error indicators for hibernate.cfg.xml file. 
  • Make sure to close the tag <hibernate-configuration>
  • Missing !character in the DOCTYPE
  • Not able to accesshibernate-configuration-3.0.dtd from the url provided.
  • Space before <?xml version='1.0' encoding='utf-8'?>