Skip to main content

K3S Commands

k3s crictl pull <imageName>

k3s kubectl get pods -n <ix-appname>

k3s kubectl get pods --all-namespaces

 

 

  1. Check Cluster Health:

    k3s kubectl get nodes

    This command checks the health and status of all nodes in the cluster.

    1. List All Pods:
      k3s kubectl get pods --all-namespaces
      This command lists all pods across all namespaces, which can help identify any pods that are not running as expected.
    1. Describe a Pod:
      k3s kubectl describe pod <pod-name> -n <namespace>
      Replace <pod-name> with the name of the pod and <namespace> with the namespace it resides in. This command provides detailed information about a specific pod, which can be useful for diagnosing issues.
    1. View Logs for a Pod:
      k3s kubectl logs <pod-name> -n <namespace>
      This command shows the logs for a specific pod. If the pod has multiple containers, you may need to specify the container name with the -c flag.
    1. Check Deployments:
      k3s kubectl get deployments -n <namespace>
      This command lists all deployments in a specific namespace, showing their desired and current states.
    1. Describe a Deployment:
      k3s kubectl describe deployment <deployment-name> -n <namespace>
      This command provides detailed information about a specific deployment.
    1. Check Services:
      k3s kubectl get svc -n <namespace>
      This command lists all services in a specific namespace, which can help troubleshoot networking and access issues.
    1. Check Persistent Volume Claims (PVCs):
      k3s kubectl get pvc -n <namespace>
      This command lists all PVCs in a specific namespace, which can help troubleshoot storage-related issues.
    1. Check ConfigMaps:
      k3s kubectl get configmaps -n <namespace>
    This command lists all ConfigMaps in a specific namespace, which can be useful for troubleshooting configuration issues.
    1. Check Ingress Resources:
      k3s kubectl get ingress -n <namespace>
      This command lists all ingress resources in a specific namespace, which can help troubleshoot external access to services.
    1. Delete a Pod:
      k3s kubectl delete pod <pod-name> -n <namespace>
      This command deletes a specific pod. Kubernetes will attempt to recreate the pod if it is managed by a controller like a Deployment or StatefulSet.
    1. Scale a Deployment:
      k3s kubectl scale deployment <deployment-name> -n <namespace> --replicas=<number>
      Replace <number> with the desired number of replicas. This command adjusts the number of replicas for a deployment, which can be useful for scaling up or down.
    Remember to replace placeholders like <pod-name>, <namespace>, <deployment-name>, and <number> with actual values relevant to your environment. Also, please note that manually scaling or deleting Kubernetes objects can have unintended consequences, especially if they are managed by Helm or other automation tools. Always ensure you understand the impact of these commands before executing them.