PV and PVC in K8S

# Please edit the object below. Lines beginning with a ‘#’ will be ignored,
# and an empty file will abort the edit. If an error occurs while saving this file will be
# reopened with the relevant failures.
#
apiVersion: v1
kind: PersistentVolume
metadata:
annotations:
kubectl.kubernetes.io/last-applied-configuration: |
{“apiVersion”:”v1″,”kind”:”PersistentVolume”,”metadata”:{“annotations”:{},”labels”:{“com.rbccm.appcode”:”ovi”},”name”:”ovi-dev2-phoenix”,”namespace”:””},”spec”:{“accessModes”:[“ReadWriteMany”],”capacity”:{“storage”:”50Gi”},”mountOptions”:[“nfsvers=3″],”nfs”:{“path”:”/ovi/kube/dev2″,”server”:”nfs.server.com”},”persistentVolumeReclaimPolicy”:”Retain”,”storageClassName”:”ovi”}}
pv.kubernetes.io/bound-by-controller: “yes”
creationTimestamp: 2019-05-02T21:34:10Z
finalizers:
– kubernetes.io/pv-protection
labels:
com.ovi.appcode: ovi
name: ovi-dev2-phoenix
resourceVersion: “203315676”
selfLink: /api/v1/persistentvolumes/ovi-dev2-phoenix
uid: 05de00f4-6d22-11e9-a8b7-0242ac11yyy
spec:
accessModes:
– ReadWriteMany
capacity:
storage: 50Gi
claimRef:     ———– >>>> if PVC is deleted —remove this part in spec ( PV is in released Status )
apiVersion: v1
kind: PersistentVolumeClaim
name: ovi-dev2-phoenix
namespace: te20-dev2
resourceVersion: “203305105”
uid: 7a0cbf09-fa8b-11e9-a244-0242ac11yyy
mountOptions:
– nfsvers=3
nfs:
path: /ovi/kube/dev2
server: nfs.server.com
persistentVolumeReclaimPolicy: Retain
storageClassName: ovi
status:
phase: Bound

LimitRange

A limit range, defined by a LimitRange object, provides constraints that can:

  • Enforce minimum and maximum compute resources usage per Pod or Container in a namespace.
  • Enforce minimum and maximum storage request per PersistentVolumeClaim in a namespace.
  • Enforce a ratio between request and limit for a resource in a namespace.
  • Set default request/limit for compute resources in a namespace and automatically inject them to Containers at runtime.

 

bash-4.2$ kubectl describe limitranges -n ovi
Name: ovi-limitrange
Namespace: ovi
Type             Resource     Min      Max    Default Request        Default Limit       Max Limit/Request Ratio
—- ——– — — ————— ————- ————————————————————
Container     memory     64Mi     32Gi     64Mi                            512Mi                10
Container        cpu         100m     16        100m                           500m                   8

 

Edit limit range

bash-4.2$ kubectl edit limitranges -n ovi

 

 

# Please edit the object below. Lines beginning with a ‘#’ will be ignored,

2 # and an empty file will abort the edit. If an error occurs while saving this file will be

3 # reopened with the relevant failures.

4 #

5 apiVersion: v1

6 kind: LimitRange

7 metadata:

8   annotations:

9     kubectl.kubernetes.io/last-applied-configuration: |

10       {“apiVersion”:”v1″,”kind”:”LimitRange”,”metadata”:{“annotations”:{},”name”:”ovi-limitrange”,”namespace”:”ovi”},”spec”:{“limits”:[{“default”:{“cpu”:”500m”,”m        emory”:”512Mi”},”defaultRequest”:{“cpu”:”100m”,”memory”:”64Mi”},”max”:{“cpu”:”16″,”memory”:”32Gi”},”maxLimitRequestRatio”:{“cpu”:”8″,”memory”:”10″},”min”:{“cpu”:”10        0m”,”memory”:”64Mi”},”type”:”Container”}]}}

11   creationTimestamp: 2019-02-13T15:54:44Z

12   name: ovi-limitrange

13   namespace: ovi

14   resourceVersion: “127366586”

15   selfLink: /api/v1/namespaces/te20/limitranges/ovi-limitrange

16   uid: ae91e929-2fa7-11e9-9dd5-0242ac110005

17 spec:

18   limits:

19   – default:

20       cpu: 500m

21       memory: 512Mi

22     defaultRequest:

23       cpu: 100m

24       memory: 64Mi

25     max:

26       cpu: “16”

27       memory: 32Gi

28     maxLimitRequestRatio:

29       cpu: “8”

30       memory: “10”

31     min:

32       cpu: 100m

33       memory: 64Mi

34     type: Container

Continue reading

k8S

kubectl get deployment -n kube-sysdig

kubectl scale deployment sysdigcloud-api –replicas=0 -n kube-sysdig

kubectl scale deployment sysdigcloud-worker –replicas=0 -n kube-sysdig

kubectl scale deployment sysdigcloud-collector –replicas=0 -n kube-sysdig

kubectl get deployment -n kube-sysdig

kubectl scale deployment sysdigcloud-worker –replicas=1 -n kube-sysdig

kubectl scale deployment sysdigcloud-collector –replicas=1 -n kube-sysdig

kubectl scale deployment sysdigcloud-api –replicas=1 -n kube-sysdig

kubectl get deployment -n kube-sysdig

 

bash-4.2$ kubectl logs sysdigcloud-collector-bc45fc -n kube-sysdig

 

*** Resource quota & limitrange

kubectl get limitrange –namespace=ovi –output=yaml

 

C:\ovi\docker

λ kubectl describe limitrange  –namespace=ovi   

Name:       ovi-limitrange

Namespace:  wdu0

Type          Resource      Min    Max  Default Request  Default Limit  Max Limit/Request Ratio

—-          ——–  —   —  —————  ————-  ———————–

Container     cpu          100m    4    100m             500m           –

Container    memory    64Mi   4Gi  64Mi             512Mi

 

C:\ovi\docker

λ kubectl describe quota  ovi-resourcequota -n ovi   

Name:            ovi-resourcequota

Namespace:     ovi

Resource               Used    Hard

——–                    —-    —-

limits.cpu               5500m   8

limits.memory      5632Mi  12Gi

pods                        4       10

requests.cpu           2300m   8

requests.memory    2624Mi  12Gi

 

C:\ovi\docker

λ kubectl get limitrange –namespace=ovi –output=yaml

kubectl edit quota ovi-resourcequota -n ovi

kubectl edit limitrange –namespace=wdu0 –output=yaml

 

λ kubectl get apiservices
NAME AGE
v1. 1y
v1.apps 309d
v1.authentication.k8s.io 1y
v1.authorization.k8s.io 1y
v1.autoscaling 1y
v1.batch 1y
v1.networking.k8s.io 1y
v1.rbac.authorization.k8s.io 309d
v1.storage.k8s.io 1y
v1alpha1.admissionregistration.k8s.io 1y
v1beta1.admissionregistration.k8s.io 309d
v1beta1.apiextensions.k8s.io 1y
v1beta1.apps 1y
v1beta1.authentication.k8s.io 1y
v1beta1.authorization.k8s.io 1y
v1beta1.batch 1y
v1beta1.certificates.k8s.io 1y
v1beta1.compose.docker.com 58d
v1beta1.events.k8s.io 309d
v1beta1.extensions 1y
v1beta1.metrics.k8s.io 228d
v1beta1.policy 1y
v1beta1.rbac.authorization.k8s.io 309d
v1beta1.scheduling.k8s.io 309d
v1beta1.storage.k8s.io 1y
v1beta2.apps 1y
v1beta2.compose.docker.com 58d
v2beta1.autoscaling 1y