Skip to content

Instantly share code, notes, and snippets.

View zdtsw's full-sized avatar

Wen Zhou zdtsw

View GitHub Profile
@zdtsw
zdtsw / QnA.txt
Created December 1, 2017 10:04
All about K8s setting up on CentOS7: 1 master kubint01 (ip: 10.14.48.82) + 2 nodes kubint02 and kubint03(ip: 10.14.48.83, and 10.14.48.84)
Error: cannot see nodes even "kubeadmin init" looks okej
>kubectl get nodes
Unable to connect to the server: x509: certificate signed by unknown authority (possibly because of "crypto/rsa: verification error" while trying to verify candidate authority certificate "kubernetes")
Solution:
[root@kubint01 ~]# cp /etc/kubernetes/kubelet.conf ~/.kube/config
[root@kubint01 ~]# export KUBECONFIG=$HOME/.kube/config
[root@kubint01 ~]# echo $KUBECONFIG
/root/.kube/admin.conf
[root@kubint01 ~]# kubectl get nodes
@zdtsw
zdtsw / Declarative_pipeline
Last active November 29, 2017 12:26
some basic takeaways from Declarative pipeline syntax for jenkins 2.0, see detail https://jenkins.io/doc/book/pipeline/syntax/ and https://issues.jenkins-ci.org/browse/INFRA-1053
#!groovy
@Library('deliveryLib')_
pipeline{
agent {}
environment{ VAR = credentials(VAL)}
options{}
tools{maven '****'}
triggers{ cron('H */4 * * 1-5') }
parameters{}
stages{
@zdtsw
zdtsw / bot
Created November 24, 2017 09:06
a bit about hubot
We use mattermost along with hubot for some internal fun stuff
the settings requires:
1. a server has mattermost running on
2. a server had hubot running on (could be the same server as the one mattermost is, or a dedicated one) in my case, two different servers
3. a jenkins instance (this is only when you want to interact with jenkins for some more serious stuff)
in mattermost, it requires:
1. public channel which hubot can read from (as incoming) and write to (as outgoing)
* remember in mattermost it is not possible to convert a public to private or viceversa , this can be done in slack
2. token generated by outgoing webhook : (example is based on I have a public channel named "Jon"
@zdtsw
zdtsw / selinux_key
Created November 14, 2017 09:29
everything related to container, make sure your Centos 7 has selinux disabled
sed -i --follow-symlinks 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/sysconfig/selinux
@zdtsw
zdtsw / Vault.txt
Last active November 13, 2017 12:21
different vaults, ansible-vault encrypt_string; ansible-vault file; #vault
#ansible-vault file#
create a file in your ansible, e.g mySecret.yml
>cat mySecret.yml
---
myBankId: |
12345
myPin: |
abcd
myJenkinsPsw: |
!"#¤%
@zdtsw
zdtsw / ssh checklist for publickey login
Created September 13, 2017 13:33
ssh and publickey
there are something need to check for your ssh if you try to use publickey but it does not work for you (still ask for password)
1. /etc/ssh/sshd_config on server should allow correct group :
> AllowGroups groupA groupB
2. on the target machine, ssh users folder should have right permission
700 .ssh/authorized_keys
700 .ssh/
@zdtsw
zdtsw / ansible.txt
Last active November 13, 2017 10:43
ansible information from work experience
ISSUE:
in module "unarchive"
- owner and group only set the file after decompress but not the folders
- need to use "file" module and recurse=yes set owner and group on the "top" folder after unarchive
Template:
use variable in template, ansible would set value during this template is called
use -force can overwrite any difference on target machine's template file with current one in ansible (after variable replace with value)
@zdtsw
zdtsw / flyway.txt
Created July 20, 2017 06:52
How to work with flyway in a nutshell
1. install flyway command line by downloading: flyway-commandline-4.2.0-linux-x64.tar.gz (or some later version)
2. >tar xvfz flyway-commandline-4.2.0-linux-x64.tar.gz
3. >cd flyway-4.2.0
4. >vi conf/flyway.conf
: user, pasword, url need to be updated with correct value
5. >vi sql/V1__Create_person_table.sql
: put how you want to perform on the first transition, say create table etc
6. >flyway validate to check it first
7. >flyway migrate
: if you see ERROR, try to fix it in the *.sql file you created above
@zdtsw
zdtsw / erlang.pp
Created July 10, 2017 09:46
Puppet module for install rebar along with OTP 20.0 release
class jenkins_slave::erlang ( $version ) {
file { '/etc/yum.repos.d/erlang.repo':
source => 'puppet:///modules/jenkins_slave/erlang.repo',
owner => 'root',
group => 'root',
mode => '0640',
}
package {'erlang':
@zdtsw
zdtsw / limits_jenkins2.txt
Last active June 19, 2017 08:38
summary of non-supported function in Jenkins 2.0 (away from groovy)
Limitation in Jenkins 2.0 pipeline:
org.jenkinsci.plugins.scriptsecurity.sandbox.RejectedAccessException: Scripts not permitted to use method java.lang.String split java.lang.String int
when in jenkinsfile:
def a = "jij-fhsif-vasdfs-sfa"
String[] str = a.split('-',2)
echo str[1]
also code like this:
def (first, other) = a.split('-',2)
seems not work on my side