Skip to content

Instantly share code, notes, and snippets.

View hemanth22's full-sized avatar

Hemanth B hemanth22

View GitHub Profile
@Nurlan199206
Nurlan199206 / CKA exam cheat sheet
Last active November 17, 2024 08:12
CKA exam cheat sheet
useful resources: https://github.com/ascode-com/wiki/tree/main/certified-kubernetes-administrator
alias ll='ls -l'
alias kcr='kubectl create'
alias ka='kubectl apply -f'
alias k=kubectl
alias kg='kubectl get'
alias ke='kubectl edit'
alias kd='kubectl describe'
alias kdd='kubectl delete'
name: AKS Deployment
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
AZURE_CONTAINER_REGISTRY: "repo.azurecr.io"
# Logs in to the Azure Container Registry
- uses: Azure/docker-login@v1
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
# Build and push image to Azure Container Registry
- name: Build and push image to Azure Container Registry
run: |
# Logs in to the Azure Container Registry
- uses: Azure/docker-login@v1
with:
login-server: ${{ env.AZURE_CONTAINER_REGISTRY }}
username: ${{ secrets.ACR_USERNAME }}
password: ${{ secrets.ACR_PASSWORD }}
# Build and push image to Azure Container Registry
- name: Build and push image to Azure Container Registry
run: |
name: AKS Deployment
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
AZURE_CONTAINER_REGISTRY: "repo.azurecr.io"
#!/usr/bin/env bash
# Versoin one
oc get $(oc api-resources --namspaced=true | tail -n+2 | awk '{ print $1 }' | xargs | sed -e 's/\s/,/g')
# Version two (from https://access.redhat.com/solutions/4165791)
oc api-resources --verbs=list --namespaced -o name | xargs -n 1 oc get --show-kind --ignore-not-found -n $PROJECT_NAME
curl -k "https://basic-ocp-demo-basic-ocp-demo-project.apps.cluster1.example.com/healthz"
# or build the curl URL programmatically!
curl -k "https://$(oc get route basic-ocp-demo -o jsonpath="{.spec.host}")/healthz"
@rafzei
rafzei / ctr-commands.txt
Created January 24, 2022 10:58
ctr commands
# List images in k8s
ctr --namespace k8s.io image list
# Create etcd snapshot
ctr --namespace k8s.io \
run \
--mount type=bind,src={{ backup_temp_dir.path }}/,dst=/backup/,options=rbind:rw \
--net-host \
--env ETCDCTL_API=3 \
--rm "{{ etcd_image_name.stdout | trim }}" \
@rafzei
rafzei / crictl-commands.txt
Last active October 12, 2022 10:28
crictl commands
# crictl documentation: https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/
# Runtime endpoints:
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock
sudo crictl --runtime-endpoint unix:///var/run/dockershim.sock
sudo crictl --runtime-endpoint unix:///run/crio/crio.sock
## Containers
# Get all containers

Quick Reference

  • Basic structure
    • oc [name]
    • There are some exceptions, like oc help or oc logs <pod> or oc exec
    • Most commands support oc <command> --help
  • Common resources (nouns)
    • Pods
    • Deployments
  • Services