summaryrefslogtreecommitdiff
path: root/doc/note/openshift/openshift.txt
blob: 88e33ee0fd1733988b0580f38317aa1a3c16e203 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94

OpenShift
=========

- "https://wikit.post.ch/x/rJJ9G"
  - Doc in confluence.
- "https://artifactory.tools.pnet.ch/artifactory/ext-binaries-local/redhat/openshift/clients/"
  - OC Clients Binary.


## Config

+------------------------------------------------------------------------------
| OC_EDITOR=vim
+------------------------------------------------------------------------------


## Download Logs

Houston logs sind NICHT im storage-manager. Musst direkt im houston pod
schauen.

Log paths:
- Storage Mgr -> "/data/logs/SVC_NAME"
- Service pod -> "/usr/local/jetty/logs".
- Houston pod -> "/usr/local/vertx/logs".

When tar fails all the time, try:  --ignore-failed-read

Templates:
+------------------------------------------------------------------------------
| oc -n NAMESPACE exec pod_name -- sh -c "echo 'gugus'"
| 
| # dload service logs via storage-manager
| oc -n NAMESPACE exec storage-manager-XXX -- sh -c "cd /data/logs/SVC_NAME && tar --ignore-failed-read -cz *.log*" > `date +SVC_NAME-STAGE-logs-%Y%m%d-%H%M%S.tgz`
| 
| # DLoad logs directly from a service pod
| oc -n NAMESPACE exec SVC_POD -- sh -c "cd /usr/local/jetty/logs && tar --ignore-failed-read --xform \"s:^:SVC_NAME-STAGE-logs-YYYYmmdd-HHMMSS/:\" -cz *.log*" > SAME_NAME_AS_BEFORE.tgz
| 
| # Download logs from HOUSTON:
| oc -n NAMESPACE exec houston-XXX -- sh -c "cd /usr/local/vertx/logs && tar -cz *" > `date -uIs +"houston-STAGE-logs-%Y%m%d-%H%M%SZ.tgz"`
| 
| # Download logs from EAGLE:
| oc -n NAMESPACE exec houston-XXX -- sh -c "cd /usr/local/vertx/logs && tar --xform \"s:^:houston-STAGE-logs-YYYYmmdd-HHMMSS-POD/:\" -cz *" > SAME_NAME_AS_BEFORE.tgz
+------------------------------------------------------------------------------


## Edit config maps

Configmaps for persistent changes are on
"https://gitit.post.ch/projects/SECINF/repos/openshift-isa"

To do direct manipulations:
+------------------------------------------------------------------------------
| oc get configmap
| oc edit configmap SVC_NAME-config
| oc describe configmaps SVC-config > SVC-config
+------------------------------------------------------------------------------


## Copy file to pod

(TODO: not tested yet)
tar -cz foo bar | oc -n NAMESPACE exec -i POD_NAME -- bash -c 'tar -C logs -zx'

HINT: ALL files from Current dir (.) will get uploaded (when global rsync not available).
+------------------------------------------------------------------------------
| oc -n NAMESPACE rsync . POD_NAME:/dst/dir --no-perms --exclude=* --include=MY_FILE.txt
+------------------------------------------------------------------------------


## Expose port
+------------------------------------------------------------------------------
| oc -n NAMESPACE expose service SVC_NAME --hostname=isa-SVC_NAME-STAGE.ospa.pnet.ch --port=1234 --name=isa-SVC_NAME-STAGE
+------------------------------------------------------------------------------


## up/down scale from cli. input von thom (20230815)

  oc scale dc/${SVCNAME:?} --replicas=1



## Kube Probe

  echo && ocprod exec -ti "$(ocprod get pods|egrep ston-[0-9]|cut -f1 -d' ')" -- sh -c 'true \
    && printf "c; When                    ; rsp_code; time_connect; time_redirect; time_starttransfer; time_total\n" \
    && while true; do true \
       && now=$(date -uIs) \
       && curl -sS -o/dev/null -w "r; $(date -uIs);      %{response_code};       %{time_connect}s;        %{time_redirect}s;             %{time_starttransfer}s;     %{time_total}s\n" 127.0.0.1:7012/houston/server/info \
       && sleep 5 || break \
    ;done' | tee -a C:/work/tmp/houston-prod-inPod-probe.log