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

Quick PV for local Kubernetes cluster

I do lot of Kubernetes related work either on minikube or local OpenShift cluster setup in a VM. Often I need to create a PersistentVolumeClaim a.k.a. pvc. But to use pvc you have to have a PersistentVolume or pv defined. Enter into the machine running k8s If using minikube you can do minikube ssh Create a local directory for storage mkdir /tmp/pv0001 chmod 777 /tmp/pv0001 If you are on a machine that has SELinux enabled do the following ...

April 18, 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

rpm Notes

This post will get you through all the steps needed for doing RPM packaging. Setup of the system for building rpms $ dnf -y install fedora-packager fedora-review $ sudo usermod -a -G mock vagrant $ fedora-packager-setup $ kinit surajd@FEDORAPROJECT.ORG My Notes Start reading from: Fedora packager鈥檚 guide Some macros come from redhat-rpm-config and fedora-rpm-macros. $ sudo rpm -ql redhat-rpm-config-45-1.fc25.noarch To see all macros on the system: $ rpm --showrc Koji - fedora build system fedora uses fedpkg for doing builds, while rpmbuild is for CentOS To get general info about the package $ rpm -qip ./x86_64/namaskar-1-1.fc25.x86_64.rpm OR ...

March 24, 2017 路 2 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

Packaging 'kompose' for centos paas sig

Note: This is a living document and will be updated from time to time. Following are steps to package kompose for CentOS PAAS SIG. CentOS PAAS SIG is a repository of packages where rpms related to OpenShift and eco-system around it are delivered. Setup your machine Install packages needed sudo yum update -y && \ sudo yum install -y epel-release && \ sudo yum install -y rpm-build go redhat-rpm-config make koji \ gcc byobu rpmlint rpmdevtools centos-packager Setup certs ...

March 15, 2017 路 4 min 路 Suraj Deshmukh

Testing 'fedora' and 'CentOS' kompose package

I generally do kompose package testing for fedora and CentOS. So here are the steps I follow. Fedora For respective fedora version use the tag respectively for e.g. 25 for fedora 25. Starting the environment: docker run -it registry.fedoraproject.org/fedora:26 bash Running tests: # Inside the container # Pull packages from the testing repository dnf --enablerepo updates-testing -y install kompose # Check the kompose version kompose version # Install the testing dependencies dnf install -y jq make # Pull the git repository to run the functional tests git clone https://github.com/kubernetes/kompose/ cd kompose git reset --hard $(kompose version | cut -d "(" -f2 | cut -d ")" -f1) # Run cmd tests make test-cmd CentOS epel repo Spin the CentOS environment in container. ...

March 14, 2017 路 2 min 路 Suraj Deshmukh