Kubernetes Mock Exam 1
use command line create pod
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands#run
#kubectl run --generator=run-pod/v1 nginx-pod --image=nginx:alpine
use command line create pod with labels tier=msg
#kubectl run --generator=run-pod/v1 messaging --image=redis:alpine --dry-run -o yaml > messaging.yaml
edit the yaml file add labels
metadata:
labels:
tier: msg
#kubectl create -f messaging.yaml
create namespace with name apx-x9984574
https://kubernetes.io/docs/tasks/administer-cluster/namespaces-walkthrough/#create-new-namespaces
{
"apiVersion": "v1",
"kind": "Namespace",
"metadata": {
"name": "apx-x9984574"
}
}
list node in json format
https://kubernetes.io/docs/reference/kubectl/jsonpath/
#kubectl get nodes -o json > /opt/outputs/nodes-z3444kd9.json
create service with command line
https://kubernetes.io/docs/tasks/access-application-cluster/service-access-application-cluster/
#kubectl expose pod messaging --type=ClusterIP --name=messaging-service --port=6379
create deployment
#kubectl run hr-web-app --image=kodekloud/webapp-color --replicas=2
create static pod
cp existing pod yaml file
Change the name
copy the file to /etc/kubernetes/manifests
create pod specific the namespace
#kubectl run --generator=run-pod/v1 temp-bus --image=redis:alpine --namespace=finance
fix the pod issue
find the root cause
create yaml file
delete pod and recreate it
export service
#kubectl expose deployment hr-web-app --type=NodePort --name=hr-web-app-service --port=8080 --target-port=30082
json fetch
https://kubernetes.io/docs/reference/kubectl/jsonpath/
create pv
https://kubernetes.io/docs/tasks/configure-pod-container/configure-persistent-volume-storage/#create-a-persistentvolume
apiVersion: v1
kind: PersistentVolume
metadata:
name: pv-analytics
spec:
capacity:
storage: 100Mi
accessModes:
- ReadWriteMany
hostPath:
path: "/pv/data-analytics"
Comments
Post a Comment