Horje
kubectl commands Code Example
bash install kubectl
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.18.0/bin/linux/amd64/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl version --client
kubectl restart deployment
kubectl rollout restart deployment yourDeploymentName
kubectl get pods
# Get pods in default namespace
kubectl get pods

#Get Pods in my-namespace
kubectl get pods -n my-namespace

#Get Pods in all namespaces
kubectl get pods --all-namespaces
kubernetes get deployments
# Get pods in default namespace
kubectl get deployments

#Get Pods in my-namespace
kubectl get deployments -n my-namespace

#Get Pods in all namespaces
kubectl get deployments --all-namespaces
kubectl commands
kubectl apply -f my-manifest.yaml  	# create resource(s)
kubectl delete -f my-manifest.yaml  # delete resource(s)

kubectl get pods                # List all pods in the namespace
kubectl get pods -o wide		# List all pods in ps output format with more information	
kubectl get pods -n <namespaces-name>	# List all pods in particular namespaces
kubectl get svc              	# List all services in the namespace
kubectl get svc -A	         	# List all services in the all namespace
kubectl get nodes				# Get list Nodes in cluster
kubectl get ns					# List Namespace
kubectl create deployment my-dep --image=nginx  # Create Deployment
kubectl edit pods/<pod-name>    # Edit Pods 
kubectl describe svc/<service-name>  # Describe a Services
kubectl logs <pod-name>		 # logs from pod
kubectl port-forward svc/my-service 5000:my-service-port  # Forward Service target port to local port 5000

# All kubectl Commands
https://kubernetes.io/docs/reference/generated/kubectl/kubectl-commands
# Cheatsheet 
https://kubernetes.io/docs/reference/kubectl/cheatsheet/
kubectl describe to yaml
kubectl describe <type> <name> -o yaml




Shell

Related
ubuntu errors were encountered while processing libc-bin Code Example ubuntu errors were encountered while processing libc-bin Code Example
kubectl cheat sheet Code Example kubectl cheat sheet Code Example
copy code from one repo to another git Code Example copy code from one repo to another git Code Example
list inactive services ubuntu Code Example list inactive services ubuntu Code Example
start new git repo from project Code Example start new git repo from project Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
17