Tips

Tips

  • Use --dry-run=client to create a pod template as the starting point. Example: k run webapp --image=my-webapp --dry-run=client -o yaml > webapp.yaml
    • This will create webapp.yaml with the following contents:
      apiVersion: v1 kind: Pod metadata: creationTimestamp: null labels: run: webapp name: webapp spec: containers: - image: my-webapp name: webapp resources: {} dnsPolicy: ClusterFirst restartPolicy: Always status: {}
  • Use the following tool to quickly switch between contexts and namespaces:
    • Run brew install kubectx to install both kubectx and kubens
    • kubens - switch to a namespace in a dropdown (requires fzf to be installed)
  • We can install plugins from Installing Addons | Kubernetes to add functionalities that are not natively provided by K8s. These include networking solutions, service discovery etc.