Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/gautric/k8s-ocp-tips


https://github.com/gautric/k8s-ocp-tips

k8s kubernetes ocp openshift tips

Last synced: 10 days ago
JSON representation

Awesome Lists containing this project

README

        

# Kubernetes & Openshift Tips (K8S OCP)

## Openshift Registry URL

#### Open the route footnote:nca[need clusteradmin role]
oc patch configs.imageregistry.operator.openshift.io/cluster --patch '{"spec":{"defaultRoute":true}}' --type=merge

#### Retrieve the route
oc get route default-route -n openshift-image-registry --template='{{.spec.host }}'

REGISTRY_ROUTE=$(oc get route default-route -n openshift-image-registry --template='{{.spec.host }}')

#### Login with docker/podman CLI

podman login -u $(oc whoami) -p $(oc whoami -t) --tls-verify=false ${REGISTRY_ROUTE}

docker login -u $(oc whoami) -p $(oc whoami -t) ${REGISTRY_ROUTE}

#### Tag Image locally

docker tag ${IMAGE_NAME}:latest ${IMAGE_NAME}:${IMAGE_VERSION}

docker tag ${IMAGE_NAME}:${IMAGE_VERSION} ${REGISTRY_ROUTE}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_VERSION}

#### Push to Openshift Registry

docker push ${REGISTRY_ROUTE}/${NAMESPACE}/${IMAGE_NAME}:${IMAGE_VERSION}

### ServiceAccount role

#### Add admin Role to SA

oc adm policy add-role-to-user admin system:serviceaccount:${NAMESPACE}:default -n ${NAMESPACE}

### OpenShift

#### Check Openshift version

kubectl get clusterversion version -o yaml

#### Retrieve YAML from OC client command

--dry-run=client -o yaml

### Operator

#### List all Operator available

kubectl get packagemanifests -n openshift-marketplace

#### Describe Operator

kubectl describe packagemanifests ${OPT_NAME} -n openshift-marketplace

### Logs

oc logs -f ${POD}

### Build

oc start-build ${BUILD_CONFIG} --follow

### Secret

oc get secret/${SECRET} -o json | jq '.data["tls.crt"]' -r | base64 -d

### Delete

oc delete all,configmap,pvc,serviceaccount,rolebinding,dc,bc --selector app=${APP}


### Deployment

#### Get the deployment name

kubectl get deployment

#### Restart the deployment

kubectl rollout restart deployment

### Helm

#### Create Helm Chart

helm create

#### Create Helm Chart

helm install . --namespace

#### Debug Helm Chart

helm install . --namespace --dry-run --debug

#### Delete Helm Chart

helm delete --namespace