Skip to content

kubectl #2

Open
Open
@prayagupa

Description

@prayagupa

https://github.com/prayagupd/onlywallet-nodejs/tree/master/onlywallet-kubectl

https://docs.openshift.com/enterprise/3.0/architecture/core_concepts/pods_and_services.html

config

$ k8s config view
apiVersion: v1
clusters:
- cluster:
    insecure-skip-tls-verify: true
    server: https://dev.duwamish.com:8443
  name: dev.duwamish.com:8443
contexts:
- context:
    cluster: dev.duwamish.com:8443
    namespace: onlywallet-api-dev
    user: prayagupd/dev.duwamish.com:8443
  name: esp-caip-api-dt-bdc-na/dev.duwamish.com:8443/prayagupd
current-context: onlywallet-api-dev/dev.duwamish.com:8443/prayagupd
kind: Config
preferences: {}
users:
- name: prayagupd/dev.duwamish.com:8443
  user:
    token: BglmitOIQhpVzlTlOIJ-lfXdHcNY7LloXKvRxtlBsBg

cluster events

$ k8s get events
LASTSEEN   FIRSTSEEN   COUNT     NAME                   KIND      SUBOBJECT   TYPE      REASON             SOURCE                                  MESSAGE
23s        3h          182       onlywallet-1-0-1-2-khlxq   Pod                   Warning   DNSSearchForming   kubelet, onlywallet.duwamish.com   Search Line limits were exceeded, some dns names have been omitted, the applied search line is: onlywallet.svc.cluster.local svc.cluster.local cluster.local.duwamish.com duwamish.com naretail.duwamish.com

cluster deployment

$ k8s get deployments
No resources found.

cluster services

k8s get services -o wide

k8s describe services/onlywallet-service
Type:			ClusterIP //could be LB as well?
IP:			a.b.c.d
Port:			8080-tcp	8080/TCP
Endpoints:		x.y.z.a:8080

cluster pods

alias k8s=oc37
k8s describe pods/onlywallet-pod

    Liveness:	http-get http://:8080/heartbeat delay=90s timeout=1s period=10s #success=1 #failure=3
    Readiness:	http-get http://:8080/heartbeat delay=0s timeout=1s period=5s #success=1 #failure=10
QoS Class:	Burstable
Node-Selectors:	zone=appnodes
Tolerations:	<none>


$ k8s delete pods onlywallet-1-0-1-2-rmw4c
pod "onlywallet-1-0-1-2-rmw4c" deleted

ssh terminal: https://kubernetes.io/docs/tasks/debug-application-cluster/get-shell-running-container/

k8s exec -it onlywallet-pod bash
bash-4.2$ ls -l                                                                                                                                       
total 0
lrwxrwxrwx.    1 root root   7 Sep 19 14:50 bin -> usr/bin
dr-xr-xr-x.    2 root root   6 Dec 14  2017 boot
drwxr-xr-x.    5 root root 380 Oct 28 16:07 dev
drwxr-xr-x.    1 root root  66 Oct 28 16:07 etc
drwxr-xr-x.    1 root root  51 Oct 26 01:43 home
lrwxrwxrwx.    1 root root   7 Sep 19 14:50 lib -> usr/lib
lrwxrwxrwx.    1 root root   9 Sep 19 14:50 lib64 -> usr/lib64
drwxr-xr-x.    2 root root   6 Dec 14  2017 media
drwxr-xr-x.    2 root root   6 Dec 14  2017 mnt
drwxr-xr-x.    2 root root   6 Dec 14  2017 opt
dr-xr-xr-x. 1175 root root   0 Oct 28 16:07 proc
dr-xr-x---.    1 root root  18 Oct 26 01:41 root
drwxr-xr-x.    1 root root  18 Oct 26 01:43 run
lrwxrwxrwx.    1 root root   8 Sep 19 14:50 sbin -> usr/sbin
drwxr-xr-x.    2 root root   6 Dec 14  2017 srv
dr-xr-xr-x.   13 root root   0 Oct  9 00:47 sys
drwxrwxrwt.    1 root root  45 Oct 26 01:43 tmp
drwxr-xr-x.    1 root root  69 Sep 19 14:50 usr
drwxr-xr-x.    1 root root  52 Sep 19 14:50 var

Secrets

https://kubernetes.io/docs/concepts/configuration/secret/

https://kubernetes.io/docs/tasks/administer-cluster/encrypt-data/

alias kubec=oc37
kubec project updupd
kubec get secrets

$ kubec describe secrets/db-password
Name:		db-password
Namespace:	updupd
Labels:		<none>
Annotations:	<none>

Type:	Opaque

Data
====
db-password:	17 bytes

also,

$ kubec get secrets/my-db-password -o yaml
apiVersion: v1
data:
  my-db-password: abccdefghijklmnopq
kind: Secret
metadata:
  creationTimestamp: 2018-08-01T12:19:07Z
  name: my-db-password
  namespace: updupd
  resourceVersion: "679098059"
  selfLink: /api/v1/namespaces/updupd/secrets/my-db-password
  uid: _____
type: Opaque

Resourcs

https://kubernetes.io/docs/tasks/administer-cluster/out-of-resource/

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions