terça-feira, 17 de outubro de 2017

debugging cluster kubernetes

In one more work even... trying to check if my app is running in my cluster... kubectl response no pod running.. all nodes gone :(

so here start my debug journey


accessing one node:


checking if kube process are running

ps -ef | grep kube


core@k8s-node-2017:~$ ps -ef | grep kube
root       1739      1  0 15:16 ?        00:00:03 /hyperkube proxy --cluster-cidr=10.100.0.0/16 --master=http://10.120.6.4:8080
core      24484  23080  0 15:42 pts/0    00:00:00 grep --color=auto kube


running OK


check kubelets logs

journalctl -u kubelet -f --no-pager


Oct 17 15:44:56 k8s-node-2017 systemd[1]: kubelet.service: Main process exited, code=exited, status=1/FAILURE
Oct 17 15:44:56 k8s-node-2017 systemd[1]: kubelet.service: Unit entered failed state.
Oct 17 15:44:56 k8s-node-2017 systemd[1]: kubelet.service: Failed with result 'exit-code'.


kubectl are logging error

checking all services:

Oct 17 15:21:42 k8s-node-2017 systemd[1]: docker-dnsmasq.service: Unit entered failed state.
Oct 17 15:21:42 k8s-node-2017 systemd[1]: docker-dnsmasq.service: Failed with result 'exit-code'.
Oct 17 15:21:43 k8s-node-2017 systemd[1]: kube-docker.service: Service hold-off time over, scheduling restart.
Oct 17 15:21:43 k8s-node-2017 systemd[1]: Stopped kube docker - docker for our k8s cluster.
Oct 17 15:21:43 k8s-node-2017 systemd[1]: Starting kube docker - docker for our k8s cluster...
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: Device "flannel.1" does not exist.
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: flannel ip address:
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: DNS ip address: ...1
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: starting docker daemon with flannel CIDR:...1/24
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: invalid value "...1" for flag --dns: ...1 is not an ip address
Oct 17 15:21:43 k8s-node-2017 kube-docker.sh[7240]: See 'dockerd --help'.


here we see one problem with flannel service.

checking kube-flannel:

journalctl -u kube-flannel -f

config: 100: Key not found (/coreos.com) [6578]
Oct 17 15:53:41 k8s-node-2017 kube-flannel.sh[1759]: timed out
Oct 17 15:53:41 k8s-node-2017 kube-flannel.sh[1759]: E1017 17:53:41.837899    1759 main.go:344] Couldn't fetch network config: 100: Key not found (/coreos.com) [6578]


seems that etcd lost cluster entries..

debugging master:

debung master etcd:

core@k8s-master-2017:~$ etcdctl ls /registry
/registry/serviceaccounts
/registry/ranges
/registry/services
/registry/events
/registry/namespaces
/registry/apiregistration.k8s.io


master lost flannel config.. because master reboot.. how here we used etcd like master  + proxies.. not like cluster.. we need persist etcd config on disk not ephemeral..

quarta-feira, 11 de março de 2015

Rodando Scrapy com Docker

Olá, Hoje irei falar sobre um Dockerfile criado para rodar um Docker do spider/Scrapy criado nesse post (link)

A ideia do post não é explicar como funciona ou o que é o Docker, pois há inumeros tutorias e conteúdos na internet explicando muito bem o que é o Docker. Sendo assim, para rodar o Dockerfile apresentado abaixo em sua máquina, será preciso ter o Docker instalado previamente em seu ambiente.

Dockerfile

sexta-feira, 27 de fevereiro de 2015

Tutorial Scrapy

Fala pessoal, nesse post vou tentar repassar um pouco do que aprendi estudando Scrapy (Python) nos últimos dias.

O post vai descrever um spider básico que lista em um JSON todos os tópicos criados nas duas primeiras páginas do site guj.com.br.

Ambiente:

- Ubuntu 14.04
- Sublime text

Ferramentas utilizadas:
- Scrapy
- Python
- virtualenv


# Instalando e criando ambiente virutalenv

Para quem não conhece, virtualenv é uma ferramenta que isola seu ambiente. Muito útil para quem trabalha com mais de um projeto na mesma máquina ou para resolver problemas de permissões.

* Instalando virtualenv
$sudo pip install virtualenv

* Criando um novo ambiente
$virtualenv NomeDoAmbiente

* Ativando ambiente
$source ./NomeDoAmbiente/bin/activate


quinta-feira, 29 de janeiro de 2015

Acesso SSH com Keys

Acesso SSH com Keys

Abaixo será descrito como acessar um servidor remoto com par de chaves privada/publica. Além de não precisar inserir a senha a cada acesso, acessar um servidor através de chaves torna o acesso mais seguro.

1 - Criando RSA Key Pair

ssh-keygen -t rsa


Você pode optar por deixar o passphrase vazio.

2 - para copiar chave pública para o servidor remoto vamos utilizar o ssh-copy-id;

ssh-copy-id -i ~/.ssh/id_rsa.pub "user@192.168.0.2"



segunda-feira, 22 de dezembro de 2014

Web Crawler MEAN (MongoDB, Express, Angular e NodeJS) Part º2

Hello,

This post is the second part of tutorials about MEAN. Today we will see about crawler logic with cheerio (node lib).

In app.js declare crawler class:

var crawler = require('./routes/crawler.js');


After we set one timer for get source:

setInterval(function(){

    console.log('trying crawler in:' + new Date());

    download(options, function downloadResult(data) {

      if (data) {

          findKeywordsAndusers(data, parseHtml);

      }

      else console.log("error");  

    });

},  1 * 60 * 1000);


The code above will call function download and in call back return will call function findKeywordsAndusers with function callback parseHtml in parameter.

The main logic in function parseHtml:

#load html download from function download

var $ = cheerio.load(data);



#iterate through each element 'li' and get element in tag 'h3' with link

$("li").each(function(i, e) {

    var title = $(e).find("h3>a").text();



}



After get the element what we need, the rest of logic is about retrieve keywords for match with title and send e-mail for alert.

sexta-feira, 28 de novembro de 2014

Web Crawler MEAN (MongoDB, Express, Angular e NodeJS)

Hello,

This post i will try explain about one web cralwer made for me in NodeJS + Mongo + AngularJS. The post focus doesn't be one tutorial, the focus is share my little knowledge about MEAN (MongoDB, Express, Angular e NodeJS).

The posts will separete in tree steps:


1 - Initial Config
2 - Web crawler logic
3 - Keywords AngularJS CRUD

1- Initial Config


#Requeriments:

 

NodeJS
Node Express
MongoDB
Bower

quinta-feira, 1 de agosto de 2013

SCJP mock exam FREE!!

Olá,

Estou estutando para SCJP e procurando na net por simulados. Encontrei um site com simulados WEB e FREE. Você consegue selecionar o assunto dos testes, tempo de duração e mais algumas configurações.. e melhor ainda.. você consegue pausar e continuar a prova depois!


http://scjptest.com

terça-feira, 30 de julho de 2013

Configuration HTTPs JBoss 7x

Hi,

This post is about how to set https over JBoss 7x. The new Jboss architecture is most simply than old versions. Basically the all configuration is location in "${JBOSS_HOME}\standalone\configuration\standalone.xml"

Add these lines below in ${JBOSS_HOME}\standalone\configuration\standalone.xml:

    

If you need change https port for default https port (443), change the line below in the same file ${JBOSS_HOME}\standalone\configuration\standalone.xml"


So, the next post I will talk about how to generate a self-signed digital certificate.

quinta-feira, 25 de julho de 2013

Alterando Locale default JBoss

Olá.

Dica rápida, para alterar o Locale do JBoss basta adicionar os seguintes argumentos ao seu JBoss

-Duser.country=BR -Duser.language=pt  
Abraço e até a próxima

quarta-feira, 23 de maio de 2012

Tutorial - Configuração JAAS JBoss 6.1

Fala pessoal,

Vou descrever um pequeno tutorial de como configurar o JAAS no JBoss 6.1 Final e capturar o usuário em sua aplicação após a autenticação. Como é meu primeiro tutorial, dúvidas e sugestões são bem vindas!

1º Passo: Alterar o arquivo "jboss-6.1.0.Final/server/default/conf/login-config.xml" adicionando a política de autenticação utilizada na apliacação

    
        
            java:/lugarcerto
            SELECT U.SENHA FROM USUARIO U WHERE U.EMAIL=?
            SELECT P.DS_PERFIL, 'Roles' FROM USUARIO U
       INNER JOIN PERFIL P ON U.PERFIL_ID_PERFIL = P.ID_PERFIL WHERE U.EMAIL=?
     MD5
     hex
        
    
Pontos importantes:
Linha 1: nome da configuração
Linha 3: Nome da classe que implementará o processo de login, neste caso utilizaremos uma classe do próprio jboss, "DatabaseServerLoginModule". Informarei no final do tutorial um link para outro tutorial, no qual a classe login module é implementada.
Linha 4: Nome do JNDI Name
Linha 5: SQL para buscar a senha forme um identificador, no caso foi utilizado o email como identificador do usuário.
Linha 6: SQL para buscar as roles(papéis) necessários para autenticar no sistema. Caso o usuário no banco não tenha o papel configurado, o acesso não é liberado. Estas roles serão configuradas mais a frente, no arquivo web.xml
Linha 8 e 9: Definição do algoritmo e enoding referente a senha. Isto é muito importante, caso o encoding do Hash utilizado para gerar a senha não seja o mesmo configurado neste arquivo, a autenticação não será liberada!


terça-feira, 10 de janeiro de 2012

HTTP Status Codes

Informational
  • 100 - Continue
    A status code of 100 indicates that (usually the first) part of a request has been received without any problems, and that the rest of the request should now be sent.
  • 101 - Switching Protocols
    HTTP 1.1 is just one type of protocol for transferring data on the web, and a status code of 101 indicates that the server is changing to the protocol it defines in the "Upgrade" header it returns to the client. For example, when requesting a page, a browser might receive a statis code of 101, followed by an "Upgrade" header showing that the server is changing to a different version of HTTP.

Successful

  • 200 - OK
    The 200 status code is by far the most common returned. It means, simply, that the request was received and understood and is being processed.
  • 201 - Created
    A 201 status code indicates that a request was successful and as a result, a resource has been created (for example a new page).
  • 202 - Accepted
    The status code 202 indicates that server has received and understood the request, and that it has been accepted for processing, although it may not be processed immediately.
  • 203 - Non-Authoritative Information
    A 203 status code means that the request was received and understood, and that information sent back about the response is from a third party, rather than the original server. This is virtually identical in meaning to a 200 status code.
  • 204 - No Content
    The 204 status code means that the request was received and understood, but that there is no need to send any data back.
  • 205 - Reset Content
    The 205 status code is a request from the server to the client to reset the document from which the original request was sent. For example, if a user fills out a form, and submits it, a status code of 205 means the server is asking the browser to clear the form.
  • 206 - Partial Content
    A status code of 206 is a response to a request for part of a document. This is used by advanced caching tools, when a user agent requests only a small part of a page, and just that section is returned.

quinta-feira, 5 de janeiro de 2012

Update Mozilla Firefox from repository

Hi,

this tip is to update your mozilla firefox from repository:

$ sudo -i
# add-apt-repository ppa:mozillateam/firefox-stable
# apt-get update && apt-get dist-upgrade -y
 
Source: http://www.tiagohillebrandt.eti.br/blog/2011/03/
instalando-o-firefox-4-no-ubuntu-via-repositorio/ 

terça-feira, 3 de janeiro de 2012

Received fatal alert: unexpected_message / SoapUI

Hi,

do you get this exception in your Soap UI when you request one WebService with SSL autentication?

javax.net.ssl.SSLException: Received fatal alert: unexpected_message


Add this param for your JVM in your init script (installdir/bin/soapui.sh or installdir\bin\ soapUI-3.6.1.vmoptions)

-Dsun.security.ssl.allowUnsafeRenegotiation=true
Hi, below one tip for IllegalArgumentException:

the command (keytool -list -v -keystore) for show some information about your keystore throws this exception below:

keytool -list -v -keystore certificado.javaks
Insira a senha do armazenamento de chaves:

Tipo de armazenamento de chaves: JKS
Fornecedor de armazenamento de chaves: SUN

erro de keytool: java.lang.IllegalArgumentException: unknown format type at
java.lang.IllegalArgumentException: unknown format type at

try change the jdk version, appears to be some incompatibility. Works for me.

jdk version that threw the exception:
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

works jdk version:
java version "1.5.0_22"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_22-b03)
Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_22-b03, mixed mode)

My OS is Ubuntu 10.10

thread:
http://www.guj.com.br/java/126669-erro-importa-certificado-digitado

segunda-feira, 29 de março de 2010

Opção de Lightbox em JQuery.





Download em http://fancybox.net/home



1° Instalação:



importar JS e CSS necessários



<script type="text/javascript" src="http://code.jquery.com/jquery-1.4.2.min.js"></script>

<script type="text/javascript" src="/fancybox/jquery.fancybox-1.3.1.pack.js"></script>

<link rel="stylesheet" href="/css/jquery.fancybox-1.3.1.css" type="text/css" media="screen" />



2° Criar arquivo JS de "configuração", informa quais elementos serão mostrados no lightbox



arquivo JS exemplo:


quarta-feira, 4 de março de 2009

Versão nova da Apostila "Java Para desenvolvimento Web" está liberada

A apostila da Caelum já tinha sido reformulada há algum tempo, agora com muito mais screenshots e usando o WTP do Eclipse, além de novas versões dos frameworks utilizados.

Você pode fazer o download em:
http://www.caelum.com.br/apostilas/

sexta-feira, 6 de fevereiro de 2009

Avoid Java transactions pitfalls with Spring

Transaction processing should achieve a high degree of data integrity and consistency. This article, the first in a series on developing an effective transaction strategy for the Java platform, introduces common transaction pitfalls that can prevent you from reaching this goal. Using code examples from the Spring Framework and the Enterprise JavaBeans (EJB) 3.0 specification, series author Mark Richards explains these all-too-common mistakes.

quarta-feira, 4 de fevereiro de 2009

JavaEE 6 overview

Veja nesse artigo um overview sobre o que virá na versão 6 do JavaEE.

Algumas novidades no artigo:

* WebBeans 1.0
* JSF 2.0
* JPA 2.0
* Servlets 3.0
* JAX-RS 1.1

Fonte: TheServerSide

terça-feira, 3 de fevereiro de 2009

Overwrite methods

What's up?

this is more one tip,

if you forget this basic concept of overwrite methods


Code:


class TesteSobrescreverMetodo {
public void metodo(int i) { }
}

public class Main extends TesteSobrescreverMetodo {
public static void main(String argv[]){}


public void metodo(int i) {} //this method is overwrite because it is inherited of class TesteSobrescreverMetodo

void metodo(long i){} //method

void metodo(){} //overload of metodo, change de parameter, change de signature
}










enjoy!

segunda-feira, 26 de janeiro de 2009

JSF: Um estudo comparativo entre bibliotecas de componentes

Este trabalho é um TCC que foi desenvolvido com o objetivo de fazer uma comparação entre as principais bibliotecas de componentes jsf utilizadas atualmente:

# RichFaces

# IceFaces

# Apache Tomahawk



Vale a pena dar uma conferida!


http://beernotfoundexception.blogspot.com/2009/01/...erver-faces-jsf-um-estudo.html