0% found this document useful (0 votes)
28 views4 pages

Kubernetes Imp

The document provides instructions and examples for common Kubernetes commands like rolling updates, certificate generation, Istio installation, port forwarding, and horizontal pod autoscaling. It also includes examples of Kubernetes manifests for Ingress, PersistentVolumes, and using volumes in pods.

Uploaded by

Koushik reddy.r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
28 views4 pages

Kubernetes Imp

The document provides instructions and examples for common Kubernetes commands like rolling updates, certificate generation, Istio installation, port forwarding, and horizontal pod autoscaling. It also includes examples of Kubernetes manifests for Ingress, PersistentVolumes, and using volumes in pods.

Uploaded by

Koushik reddy.r
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 4

kubectl rollout status deployment.v1.

apps/nginx-deployment

kubectl rollout history deployment.v1.apps/nginx-deployment

kubectl rollout undo deployment.v1.apps/nginx-deployment

===================================================================================
================================

openssl req -x509 -sha256 -newkey rsa:4096 -keyout ca.key -out ca.crt -days 356 -
nodes -subj '/CN=My Cert Authority'

openssl req -new -newkey rsa:4096 -keyout server.key -out server.csr -nodes -subj
'/CN=mydomain.com'
openssl x509 -req -sha256 -days 365 -in server.csr -CA ca.crt -CAkey ca.key -
set_serial 01 -out server.crt

openssl req -new -newkey rsa:4096 -keyout client.key -out client.csr -nodes -subj
'/CN=My Client'
openssl x509 -req -sha256 -days 365 -in client.csr -CA ca.crt -CAkey ca.key -
set_serial 02 -out client.crt

export PATH=$PWD/bin:$PATH

ISTIO SETUP IMP CMD:


====================
after down loading istion from
curl -L https://istio.io/downloadIstio | sh -

cd to bin dir and move istionctl to /usr/local/bin dir

sudo mv istioctl /usr/local/bin

after moving verify by typing which istioctl

istioctl manifest apply --set profile=demo (creates istiomest set up on kubernetes


cluster)

istioctl manifest generate --set profile=demo > temp/istio.yaml (copys the all the
manifest file to file)

istioctl verify-install -f temp/istio.yaml (verify the installation of istioon


cluster)

check it on cluster by kubectl get all --all-namespaces

Add a namespace label to instruct Istio to automatically inject Envoy sidecar


proxies when you deploy your application later

kubectl label namespace default istio-injection=enabled

Deploy the Bookinfo sample application:

kubectl apply -f samples/bookinfo/platform/kube/bookinfo.yaml


kubectl exec -it ratings-v1-64f9dffdf7-rpcj4 sh

Associate this application with the Istio gateway:


kubectl apply -f samples/bookinfo/networking/bookinfo-gateway.yaml

Ensure that there are no issues with the configuration:


istioctl analyze

portforwarding cmd:
===================
kubectl -n istio-system port-forward grafana-64986f9974-xgccq 3000:3000

kubectl -n istio-system port-forward pod/kiali-7fcc47db9f-5pvcn

kubectl create secret generic datadog-secret --from-literal api-


key="eea3009e5a557b288695bf6753d1ef10" --namespace="default"

kubectl -n monitoring port-forward prometheus-grafana-5d9b75684c-mkqkd 80:3000

Auto scaling
============
kubectl autoscale deploy nginx --min 10 --max --15 --cpu-percent 20

apiVersion: autoscaling/v2beta1
kind: HorizontalPodAutoscaler
metadata:
name: nodejs
spec:
maxReplicas: 12
minReplicas: 10
scaleTargetRef:
apiVersion: extensions/v1beta1
kind: Deployment
name: nodejs
metrics:
- type: Resource
resource:
name: memory
targetAverageUtilization: 50

apiVersion: autoscaling/v1
kind: HorizontalPodAutoscaler
metadata:
name: nodejs-cpu
spec:
maxReplicas: 4 # maximum replicas of pods
minReplicas: 1
scaleTargetRef:
apiVersion: extensions/v1v1beta1
kind: Deployment
name: nodejs
# TARGET name of the deployment the autoscaler need to be run on
targetCPUUtilizationPercentage: 30
# CPU maximum amount of use on the pod is set to 30%.

stress --vm 2 --vm-bytes 200M


===================================================================================
=======

1 - avg(rate(node_cpu{mode="idle"}[1m]))
sum(node_load1)/sum(node:node_num_cpu:sum)

===================================================================================
=======
Ingress
apiVersion: networking.k8s.io/v1beta1
kind: Ingress
metadata:
name: test-ingress
spec:
rules:
- http:
paths:
- path: /testpath
pathType: Prefix
backend:
serviceName: test
servicePort: 80
===================================
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-voll
spec:
capacity:
storage: 5Gi
volumeMode: Filesystem
accessModes:
- ReadWriteOnce
persistentVolumeReclaimPolicy: Recycle
awsElasticBlockStore:
volumeID: <volume-id>
fsType: ext4
================================
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: myclaim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 500Mi

climing volume in pod..


-----------------------
apiVersion: v1
kind: Pod
metadata:
name: mypod
spec:
containers:
- name: myfrontend
image: nginx
volumeMounts:
- mountPath: "/var/www/html"
name: mypd
volumes:
- name: mypd
persistentVolumeClaim:
claimName: myclaim
========================================================================

kubectl create secret generic db-user-pass --from-file=./username.txt --from-


file=./password.txt

apiVersion: v1
kind: Secret
metadata:
name: mysecret
type: Opaque
data:
username: YWRtaW4=
password: MWYyZDFlMmU2N2Rm
================================

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy