rasti.hil@hilandco.com +41 79 367-9677

Search This Blog

Kubernetes command



# Rancher
kubectl get -n cattle-system pods 


kubectl get secret --namespace cattle-system bootstrap-secret -o go-template='{{.data.bootstrapPassword|base64decode}}{{"\n"}}'

kubectl -n cattle-system logs -f $(kubectl -n cattle-system get pods | grep ^rancher | head -n 1 | awk '{ print $1 }') 


kubectl delete namespace cattle-system


# Pods
kubectl get pods --show-labels

kubectl describe pod -l app=app1

kubectl exec deploy/app1 -- hostname
kubectl exec deploy/app1 -- killall5

kubectl get pods
kubectl delete pods -l app=app1

# Deployment
kubectl apply -f file.yaml

kubectl apply -f web/


# Services
kubectl get svc
kubectl get pods -l app=web

kubectl logs -l app=web
kubectl get svc web

# Execute
kubectl exec deploy/app1 -- nslookup web
kubectl exec deploy/app1 -- curl http://web:8080

# Output 
kubectl get svc bb-web -o jsonpath='{}'
kubectl get svc bb-web -o jsonpath='http://{.status.loadBalancer.ingress[0].*}:8080'


# Endpoint
kubectl get endpoints
kubectl get all -l demo=workshop1
kubectl delete all -l demo=workshop1

# ConfigMap
kubectl get configmaps -A




kubectl describe  configmap ample -n ns


# Container Deployment
kubectl run http --image=docker-http-server:latest --replicas=1
kubectl get deployments
kubectl describe deployment http
kubectl expose deployment http --external-ip="172.17.0.29" --port=8000 --target-port=80
kubectl get svc

# Replication Controller
kubectl create -f redis-master-controller.yaml
kubectl get rc

kubectl get pods