Skip to content

Instantly share code, notes, and snippets.

View vlobachev's full-sized avatar
🏘️
academic approaches

Vitaly Lobachev vlobachev

🏘️
academic approaches
View GitHub Profile
@vlobachev
vlobachev / delete-git-recursively.sh
Created November 30, 2023 16:41 — forked from facelordgists/delete-git-recursively.sh
Recursively remove .git folders
( find . -type d -name ".git" && find . -name ".gitignore" && find . -name ".gitmodules" ) | xargs rm -rf

Upgrading Kubernetes Cluster with Kops, and Things to Watch Out For

Alright! I'd like to apologize for the inactivity for over a year. Very embarrassingly, I totally dropped the good habit. Anyways, today I'd like to share a not so advanced and much shorter walkthrough on how to upgrade Kubernetes with kops.

At Buffer, we host our own k8s (Kubernetes for short) cluster on AWS EC2 instances since we started our journey before AWS EKS. To do this effectively, we use kops. It's an amazing tool that manages pretty much all aspects of cluster management from creation, upgrade, updates and deletions. It never failed us.

How to start?

Okay, upgrading a cluster always makes people nervous, especially a production cluster. Trust me, I've been there! There is a saying, hope is not a strategy. So instead of hoping things will go smoothly, I always have bias that shit will hit the fan if you skip testing. Plus, good luck explaining to people

@vlobachev
vlobachev / restoreMongo_bucket.sh
Created October 31, 2022 17:09 — forked from njadhav1/restoreMongo_bucket.sh
Restore MongoDB backup from AWS S3
#!/bin/bash
########
# Purpose :- To Restore backup of MongoDB Collections from AWS s3
# Requirement :- Make Sure you took backup via backupMongo_bucket.sh
# Bug Report to :- jadhav.nitin941@gmail.com
########
PROGNAME=$(basename $0)
[ec2-user ~]$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvdf 202:80 0 100G 0 disk
xvda1 202:1 0 8G 0 disk /
The output of lsblk removes the /dev/ prefix from full device paths. In this example, /dev/xvda1 is mounted as the root device (note the MOUNTPOINT is listed as /, the root of the Linux file system hierarchy), and /dev/xvdf is attached, but it has not been mounted yet.
Determine whether you need to create a file system on the volume. New volumes are raw block devices, and you need to create a file system on them before you can mount and use them. Volumes that have been restored from snapshots likely have a file system on them already; if you create a new file system on top of an existing file system, the operation overwrites your data. Use the sudo file -s device command to list special information, such as file system type.
[ec2-user ~]$ sudo file -s /dev/xvdf
/dev/xvdf: data
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@vlobachev
vlobachev / repo-full-copy.sh
Created February 18, 2022 11:38 — forked from AgiosAndreas/repo-full-copy.sh
Полный перенос git репозитория на другой сервер
# Клонируем исходный репозиторий без рабочего каталога (--bare)
git clone --bare https://github.com/exampleuser/old-repository.git
cd old-repository.git
# Делаем mirror-push(будут скопированы все ветки и тэги) в новый репозиторий
git push --mirror https://github.com/exampleuser/new-repository.git
cd ..
# Удаляем папку с репозиторием
@vlobachev
vlobachev / README.md
Created August 3, 2020 10:01 — forked from danielepolencic/README.md
Create 3 nodes Kubernetes cluster locally with Vagrant

3 Virtual Machines Kubernetes cluster

Dependencies

You should install VirtualBox and Vagrant before you start.

Creating the cluster

You should create a Vagrantfile in an empty directory with the following content:

@vlobachev
vlobachev / docker-compose.yml
Created June 30, 2020 08:48 — forked from thomasdarimont/docker-compose.yml
Docker OpenLDAP + phpldapadmin example
version: '2'
services:
openldap:
image: osixia/openldap:1.2.3
container_name: openldap
environment:
LDAP_LOG_LEVEL: "256"
LDAP_ORGANISATION: "Example Inc."
LDAP_DOMAIN: "example.org"
LDAP_BASE_DN: ""
@vlobachev
vlobachev / Makefile
Created April 3, 2020 21:32 — forked from ktrysmt/Makefile
aws account context switcher by Makefile
.DEFAULT_GOAL:=help
THIS_FILE := $(lastword $(MAKEFILE_LIST))
CRED_TMP := /tmp/.credentials.tmp
CRED := ~/.aws/credentials
PARENT:=iamA
SERIAL:=arn:aws:iam::1234567890ab:mfa/iam-username
DURATION:=
code:=000000
@vlobachev
vlobachev / Makefile
Created April 3, 2020 21:32 — forked from ktrysmt/Makefile
aws account context switcher by Makefile
.DEFAULT_GOAL:=help
THIS_FILE := $(lastword $(MAKEFILE_LIST))
CRED_TMP := /tmp/.credentials.tmp
CRED := ~/.aws/credentials
PARENT:=iamA
SERIAL:=arn:aws:iam::1234567890ab:mfa/iam-username
DURATION:=
code:=000000