- Basic structure
- oc [name]
- There are some exceptions, like
oc help
oroc logs <pod>
oroc exec
- Most commands support
oc <command> --help
- Common resources (nouns)
- Pods
- Deployments
- Services
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
function finish { | |
rm -rf $TMPDIR | |
} | |
trap finish EXIT | |
TMPDIR=$(mktemp -d) | |
oc get nodes -o name > $TMPDIR/all-nodes | |
oc get nodes -o name -l logging-infra-fluentd=true > $TMPDIR/labeled-nodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
kubernetes commands | |
kubectl config view - посмотреть к какому кластеру подключен kubectl (API IP:PORT) | |
kubectl get pods && kubectl get services --all-namespaces | |
kubectl get nodes - список нодов | |
kubectl exec -it postgres-57f4746d96-7z5q8 -- psql -U username databasename - подключиться к psql |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cd k8s-specs | |
# Only if minishift | |
oc apply -f sa/jenkins-no-sa-oc.yml --record | |
# Only if NOT minishift | |
kubectl apply \ | |
-f sa/jenkins-no-sa.yml \ | |
--record |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Step 1 | |
oc delete pod <podsname> -n myproject --grace-period=0 --force | |
### Step 2 | |
oc edit pod <podsname> | |
#Remove deletionTimestamp | |
#Before: deletionTimestamp: 2019-12-31T11:40:28Z | |
#After: deletionTimestamp: null | |
#Remove Finalizers | |
#Before |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###Creating a template | |
oc login <YOUR_MINISHIFT_URL> | |
oc login -u system:admin | |
oc create -f <YOUR_YAML_FILE>.yaml -n openshift | |
###View/Edit template | |
oc edit template <YOUR_TEMPLATE> -n openshift | |
###View all templates available | |
oc get templates -n openshift |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Basic structure | |
- oc <verb> <noun> [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 | |
- Routes | |
- ConfigMaps |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Delete Running pods | |
for pod in $(oc get pods | grep Running | awk '{print $1}'); do oc delete pod ${pod} --grace-period=1;done | |
# Delete Secrets | |
for secret in $(oc get secrets | awk '{if (NR!=1){print $1}}'); do oc delete secret ${secret};done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Namespace per tier ### | |
oc new-project kiosk-backend | |
oc new-project kiosk-frontend | |
oc new-project kiosk-database | |
oc new-app https://github.com/jankleinert/concession-kiosk-backend --name backend -n kiosk-backend | |