$ git clone https://GENERATED_TOKEN:x-oauth-basic@github.com/owner/repo.git
Month: August 2018
Setup Linux bootable USB only using terminal
Just simple steps to setup your USB bootable with Linux image inside:
$ sudo fdisk -l $ sudo umount /dev/sdb1 $ sudo mkfs.vfat -F32 /dev/sdb1 $ sudo dd if=/path/to/ubuntu.iso of=/dev/sdb bs=4M
Install pulse secure linux 9 on Fedora 28
This installation is using pulse secure linux version 9 with rpm package ps-pulse-linux-9.0r1.0-b739-centos-rhel-64-bit-installer.rpm
$ sudo dnf install compat-libicu57-57.1-2.fc28.x86_64 $ sudo dnf install libgnome-keyring $ sudo rpm -i ps-pulse-linux-9.0r1.0-b739-centos-rhel-64-bit-installer.rpm
Create vpn shortcut (optional):
$ sudo touch /usr/bin/vpn $ sudo vim /usr/bin/vpn
Fill with this script below:
#!/bin/bash export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/pulse /usr/local/pulse/pulseUi
Make it executable:
$ sudo chmod +x /usr/bin/vpn
Now, you can just open the app with command vpn
Change default docker IP address
$ sudo systemctl stop docker $ sudo touch /etc/docker/daemon.json
{ "bip": "192.168.1.5/24", "fixed-cidr": "192.168.1.5/25" }
$ sudo systemctl start docker
Check your docker0 ip address now:
$ ip addr
Copy file/files to docker container using tar
tar -c foo.sh | docker exec -i theDockerContainer /bin/tar -C /tmp -x
Replace string in all occurrances in multiple directories
find ./ -type f -exec sed -i 's/string1/string2/g' {} \;
Run containerized python app in kubernetes
First of all we need a Docker image that will be run inside the kubernetes cluster. So I assumed that we already have a kubernetes cluster. So the next we do is to build the docker image or you can use your docker image yourself.
But in this tutorial, I will show you how to run the containerized python app with my version from the start.
What we need
These applications should be installed on your local machine before get started. In my case, I use my remote server with ubuntu 16.04 installed.
1. Docker
2. Kubernetes
Build docker image
Let’s begin with clone of of my repo that contains Dockerfile to build the image:
$ git clone https://github.com/muffat/docker-images.git
$ cd docker-images/simple-python-app/ ~/docker-images/simple-python-app$ sudo docker build -t simple .
Wait until the process successfully built. And then you’ll see a new docker image when you type this command:
$ docker images
Push docker image to repository (docker hub)
Before pushing the image to docker hub, we need to tag the successfully built image.
$ docker tag fbd064597ae4 cerpin/simple:1.0
Push the image
$ docker push cerpin/simple The push refers to a repository [docker.io/cerpin/simple] bc69ee44ef1a: Pushed 7957c9ab59bb: Pushed 2366fc011ccb: Pushed b18f9eea2de6: Pushed 6213b3fcd974: Pushed fa767832af66: Pushed bcff331e13e3: Mounted from cerpin/test 2166dba7c95b: Mounted from cerpin/test 5e95929b2798: Mounted from cerpin/test c2af38e6b250: Mounted from cerpin/test 0a42ee6ceccb: Mounted from cerpin/test
After it pushed. You will have the docker image in the repository and ready to use it:
cerpin/simple:1.0
Run the image in kubernetes
First of all, I’m not a big fan of kubectl command, so I usually make a symlink to create the shorter version of kubectl:
$ sudo ln -s /usr/bin/kubectl /usr/bin/cap
Run the docker image in kubernetes
$ cap run simple --image=cerpin/simple:1.0
Then the container will be created. Just wait a moment until the state becomes Running
$ cap get pods simple-79d85db8b9-466kd 1/1 Running 0 26m
After it’s ready, expose the service with port 5002 to become LoadBalancer. So the service will be accessible from the outside world
$ cap expose deployment simple --type=LoadBalancer --port=5002
Check the service that has been exposed:
$ cap get services simple LoadBalancer 10.105.115.251 <pending> 5002:31969/TCP 21m
You will see that the service will have forwarded port to 31969 from 5002.
If you open up the browser and navigate to http://external IP:31969, you’ll see the app is running.
Or, just use a curl command instead:
$ curl http://167.xxx.xxx.xxx:31969 { "message": "welcome", "status": "ok" }