Clean Node setup

Make sure you have npm installed. $ sudo dnf -y install npm Package npm-1:3.10.10-1.6.10.3.1.fc25.x86_64 is already installed, skipping. Dependencies resolved. Nothing to do. Complete! Taken from this post. mkdir "${HOME}/.npm-packages" echo 'prefix=${HOME}/.npm-packages' | tee -a ~/.npmrc echo ' #====================================== # npm related stuff NPM_PACKAGES="${HOME}/.npm-packages" PATH="$NPM_PACKAGES/bin:$PATH" # Unset manpath so we can inherit from /etc/manpath via the `manpath` command unset MANPATH # delete if you already modified MANPATH elsewhere in your config export MANPATH="$NPM_PACKAGES/share/man:$(manpath)" #====================================== ' | tee -a ~/.bashrc Ref: npm throws error without sudo - Stack Overflow question Install npm packages globally without sudo on macOS and Linux

July 4, 2017 路 1 min 路 Suraj Deshmukh

k8s on CRI-O - single node

Here is a single node Kubernetes on CRI-O. This setup is done on Fedora 25. Installing OS dependencies dnf -y install \ go \ git \ btrfs-progs-devel \ device-mapper-devel \ glib2-devel \ glibc-devel \ glibc-static \ gpgme-devel \ libassuan-devel \ libgpg-error-devel \ libseccomp-devel \ libselinux-devel \ pkgconfig \ wget \ etcd \ iptables Creating go environment cd ~ mkdir -p ~/go export GOPATH=~/go export GOBIN=$GOPATH/bin export PATH=$PATH:$GOBIN echo 'GOPATH=~/go' >> ~/.bashrc echo 'GOBIN=$GOPATH/bin' >> ~/.bashrc echo 'PATH=$PATH:$GOBIN' >> ~/.bashrc Pull all the code dependencies go get -d k8s.io/kubernetes go get -u github.com/cloudflare/cfssl/cmd/... Install runc go get -d github.com/opencontainers/runc cd $GOPATH/src/github.com/opencontainers/runc git reset --hard v1.0.0-rc3 make BUILDTAGS='seccomp selinux' && make install Build cri-o cd go get -d github.com/kubernetes-incubator/cri-o cd $GOPATH/src/github.com/kubernetes-incubator/cri-o make install.tools make && make install make install.config Set up CNI go get -d github.com/containernetworking/cni cd $GOPATH/src/github.com/containernetworking/cni ./build.sh mkdir -p /opt/cni/bin cp bin/* /opt/cni/bin/ mkdir -p /etc/cni/net.d/ cat > /etc/cni/net.d/10-ocid-bridge.conf <<EOF { "cniVersion": "0.2.0", "name": "ocid-bridge", "type": "bridge", "bridge": "cni0", "isGateway": true, "ipMasq": true, "ipam": { "type": "host-local", "subnet": "10.88.0.0/16", "routes": [ { "dst": "0.0.0.0/0" } ] } } EOF cat > /etc/cni/net.d/99-loopback.conf <<EOF { "cniVersion": "0.2.0", "type": "loopback" } EOF Create policy.json mkdir -p /etc/containers cat > /etc/containers/policy.json <<EOF { "default": [ { "type": "insecureAcceptAnything" } ] } EOF Make SELinux happy mkdir -p /var/lib/containers/ chcon -Rt svirt_sandbox_file_t /var/lib/containers/ Start ocid service export PATH=$PATH:/usr/local/bin/ echo 'PATH=$PATH:/usr/local/bin/' >> ~/.bashrc ocid --runtime /usr/local/sbin/runc --log /root/ocid.log --debug --selinux true Start k8s cluster with crio cd $GOPATH/src/k8s.io/kubernetes/ CONTAINER_RUNTIME=remote CONTAINER_RUNTIME_ENDPOINT='/var/run/ocid.sock --runtime-request-timeout=15m' ./hack/local-up-cluster.sh To use kubectl (in new terminal) ...

April 8, 2017 路 2 min 路 Suraj Deshmukh

Git Notes

Notes about using git. Tips and tricks Switch branches $ git checkout <branch> status $ git status -sb Show status in short format and also give branch info show $ git show Shows log message and diff about the commit you are on. log $ git log -L 70,100:pkg/transformer/kubernetes/kubernetes.go Get logs on file between line numbers. $ git log --graph --abbrev-commit Show graph in logs. commit $ git add -p Commit only parts of file. Interactively choose chunks of patch. ...

March 21, 2017 路 8 min 路 Suraj Deshmukh

Intellij Shortcuts

Note: This is a living document and will be updated as I discover new things. Shortcuts Ctrl + Shift + A Find any action in IDE Ctrl + Shift + F Find in Path Alt + 1 Open project navigator. You can search here, just start typing here, after the project navigator window is opened. Shift + Insert in Project window Here you can add new file to the project. The filename could be the entire path, so the intermediate directories will be created for you. ...

March 17, 2017 路 5 min 路 Suraj Deshmukh