Skip to content

Instantly share code, notes, and snippets.

@gosharplite
Last active July 27, 2017 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gosharplite/3908edae250dbd370aae4d871192b0b6 to your computer and use it in GitHub Desktop.
Save gosharplite/3908edae250dbd370aae4d871192b0b6 to your computer and use it in GitHub Desktop.
cloudnative

Cloud Native

CoreUpdate

Useful commands

/etc/coreos/update.conf

GROUP=stable
SERVER=http://matchbox.foo:8080/assets/coreos_update/1353.8.0/
$ sudo systemctl status update_engine
$ sudo systemctl unmask update_engine
$ sudo systemctl start update_engine
$ update_engine_client -update

# Need to update twice for A and B regions.

Links

https://gist.github.com/gosharplite/e9ede9f997769bce56f2baa63285323a
https://github.com/coreroller/coreroller#existing-machines
https://coreos.com/products/coreupdate/docs/latest/configure-machines.html
https://groups.google.com/forum/#!topic/coreos-user/FCMR_viblWY
https://coreos.com/os/docs/latest/manual-rollbacks.html

etcd2 to etcd3

Useful commands

Backing up the datastore
https://coreos.com/etcd/docs/latest/v2/admin_guide.html

# etcdctl backup --data-dir /var/lib/etcd2/ --backup-dir ./170511_1727

# This is for bug of 1122.2.0
scp -r
chown -R
etcd disaster recovery on CoreOS Container Linux
https://coreos.com/etcd/docs/latest/etcd-live-cluster-reconfiguration.html

$ sudo etcdctl backup --data-dir /var/lib/etcd2 --backup-dir /var/lib/etcd2_backup

/run/systemd/system/etcd2.service.d/98-force-new-cluster.conf drop-in file with the following contents:

[Service]
Environment="ETCD_FORCE_NEW_CLUSTER=true"

# Be careful about the ownership of etcd2
$ sudo chown -R etcd:etcd /var/lib/etcd2
check 40-etcd-cluster.conf to start a clean cluster

remove 98-force-new-cluster.conf at the end

etcdctl member list
etcdctl cluster-health
# This is for bug of 1122.2.0
/var/lib/etcd2
rsync -avzh member tony@10.128.112.11:~/etcd-backup
$ ENDPOINTS="10.128.112.15:2379,10.128.112.19:2379,10.128.112.20:2379,10.128.112.21:2379"
$ ETCDCTL_API=3 ./etcdctl --endpoints $ENDPOINTS -w table endpoint status
$ ETCDCTL_API=3 ./etcdctl --endpoints=$ENDPOINTS endpoint health

$ ETCDCTL_API=3 ./etcdctl get "" --from-key --keys-only --limit 10
$ ETCDCTL_API=3 ./etcdctl get "" --from-key --print-value-only --limit 10
$ ETCDCTL_API=3 ./etcdctl get "" --from-key --keys-only --limit 20000 | grep tony-ubuntu-40rx7

Links

https://kubernetes.io/docs/tasks/administer-cluster/upgrade-1-6/
http://coreos.com/etcd/docs/latest/
https://coreos.com/etcd/docs/2.3.2/runtime-configuration.html
https://coreos.com/etcd/docs/latest/v2/admin_guide.html
https://coreos.com/etcd/docs/latest/upgrades/upgrade_3_0.html
https://github.com/projectcalico/cni-plugin/issues/281
https://github.com/tmjd/calico/blob/56643929427925a7a2251a1144ae50932b1b48bc/v2.1/getting-started/kubernetes/upgrade.md
https://coreos.com/blog/etcd3-a-new-etcd.html
http://coreos.com/blog/toward-etcd-v3-in-container-linux.html
https://github.com/coreos/etcd/blob/master/Documentation/upgrades/upgrade_3_0.md
http://coreos.com/blog/etcd-3-1-announcement.html
https://quay.io/repository/coreos/etcd?tab=tags
https://coreos.com/etcd/docs/3.1.8/getting-started-with-etcd.html
https://coreos.com/etcd/docs/3.1.8/os-faq.html
https://github.com/coreos/etcd/releases/
https://coreos.com/etcd/docs/3.1.8/upgrades/upgrade_3_0.html
https://coreos.com/etcd/docs/latest/op-guide/v2-migration.html
https://github.com/coreos/etcd/blob/v3.2.1/etcdctl/README.md#migrate-options
https://coreos.com/blog/migrating-applications-etcd-v3.html

- vim ------------------------------------------------------
% - find ( { [ ] } )
# , * - find word under the cursor.
g# , g*
0 ^ $ g_ f F t T , ; - Move on current line.
{This is a book. It is not a pen.}
x , X - delete the character under the cursor and to the left of the cursor, respectively.
u , ctrl-r - undo and redo.
This is a book.
w , W - word and extended word
Zone selection <action>a<object> or <action>i<object>
---this;is:.:w
Visual selection: v,V,<C-v> , gv
Block selection 0<C-v><C-d>I-- [ESC]
abc
bef
123
Macros : qa do something q, @a, @@
/pattern
# , * - find word under the cursor.
:set incsearch
:set hlsearch
% - find matching ( { [
[{ - back to the {
{
{
foo
}
bar
}
bn - buffer previous
C-^ - previous buffer
viwp - past buffer on a word
"cy$
"cp
^E ^Y ^U ^D ^F ^B
~ change case
J - Join lines
iw is ip i' i" i` i( i[ i{ it
aw as ap a' a" a` a( a[ a{ at
i:<esc>ggVG:normal.<cr>
:%s/\s\+$//gc
# folds
zf zF zd zD zE
- vim-go ---------------------------------------------------
:GoUpdateBinaries
,r
,b
,c
yif , yaf
gS , gJ
ff <tab> , json <tab> , <C-j> - code template
:GoMetaLinter - style advises
:GoAlternate - jump to test file
gd , ctrl-] , ctrl-t - def movement
:GoDecls , :GoDeclsDir - similar to F8
]] , [[ - jump to func
:GoFiles - list package files
:GoDeps - list package dependency
:GoReferrers - find who is calling
:ccl , :pc , :lcl
:GoCallees , GoCallers
:GoRename
:GoFreevars
:GoImpl io.ReadWriteCloser
:GoImpl b *B fmt.Stringer
,a
:Ack
<C-x><C-o> , <tab>
- tmux -----------------------------------------------------
# session management
tmux ls (or tmux list-sessions)
tmux new -s session-name
tmux attach -t [session name]
tmux kill-session -t session-name
Ctrl-b d Detach from session
Ctrl-b s list out sessions
Ctrl-b c Create new window
Ctrl-b d Detach current client
Ctrl-b n Move to the next window
Ctrl-b p Move to the previous window
Ctrl-b & Kill the current window
Ctrl-b , Rename the current window
Ctrl-b q Show pane numbers (used to switch between panes)
Ctrl-b o Switch to the next pane
Ctrl-b ? List all keybindings
# moving between windows
Ctrl-b n (Move to the next window)
Ctrl-b p (Move to the previous window)
Ctrl-b w (List all windows / window numbers)
Ctrl-b window number (Move to the specified window number, the
default bindings are from 0 -- 9)
# Tiling commands
Ctrl-b % (Split the window vertically)
Ctrl-b " (Split window horizontally)
Ctrl-b o (Goto next pane)
Ctrl-b q (Show pane numbers, when the numbers show up type the key to go to that pane)
Ctrl-b { (Move the current pane left)
Ctrl-b } (Move the current pane right)
# Make a pane its own window
Ctrl-b : "break-pane"
Ctrl-b : "swap-window -s 0 -t 1"
# add to ~/.tmux.conf
bind | split-window -h
bind - split-window -v
# vi keys in copy mode
Ctrl-b [ - enter copy mode
Ctrl-b PageUp - enter copy mode
space - start selection
enter - end selection
Ctrl-b ] - paste
------------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment