app

command
v0.0.0-...-d7b2d65 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 2, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

README

docker save -o ubuntu.tar ubuntu:latest
scp ubuntu.tar thomas@node01:/home/thomas/images
scp ubuntu.tar thomas@node02:/home/thomas/images
scp ubuntu.tar thomas@node04:/home/thomas/images
docker load -i ubuntu.tar

CGO_ENABLED=0 go build -o pear main.go
docker build -t ants/pear:v1.0 .

docker save -o pear.tar ants/pear:v1.0
scp pear.tar thomas@node02:/home/thomas/images
scp pear.tar thomas@node04:/home/thomas/images
docker load -i pear.tar

scp -r * thomas@node02:/home/thomas/project

kubectl create namespace pear-test-ns
kubectl apply -f pv_pear.yaml
kubectl apply -f pvc_pear.yaml
kubectl apply -f deployment_pear.yaml
kubectl apply -f service_pear.yaml

kubectl get nodes
kubectl get pods --all-namespaces -o wide
kubectl get deployment --all-namespaces -o wide
kubectl get service --all-namespaces -o wide
kubectl get configmaps -n kube-system kube-flannel-cfg -o yaml

kubectl get pv --all-namespaces -o wide
kubectl get pvc --all-namespaces -o wide

kubectl delete -f deployment_pear.yaml
kubectl delete -f pvc_pear.yaml
kubectl delete -f pv_pear.yaml
kubectl delete -f service_pear.yaml

kubectl exec -it -n pear-test-ns pear-deployment-ff6c445b9-28tjk -- sh
curl http://192.168.1.10:30006/ping

Secret:
kubectl get secrets --all-namespaces -o wide

echo -n "xiaoming" | base64
echo -n "123456" | base64
echo 'eGlhb2hvbmc=' | base64 --decode

kubectl apply -f secrets.yaml
kubectl create secret generic mysecret2 --from-file=./username.txt --from-file=pw.txt
kubectl create secret generic mysecret3 --from-file=username=./username.txt --from-file=password=./pw.txt
kubectl describe secrets/mysecret2
kubectl get secret mysecret2 -o yaml

ConfigMap:
kubectl config view
kubectl apply -f configmap_pear.yaml
kubectl create configmap myconfig3 --from-file=./myconfig.yaml -n pear-test-ns
kubectl create configmap myconfig4 --from-literal=special.how=very --from-literal=special.type=charm -n pear-test-ns
kubectl get configmaps --all-namespaces
kubectl get configmaps -n pear-test-ns
kubectl get configmaps -n pear-test-ns myconfig1 -o yaml
kubectl delete -f configmap_pear.yaml


ServiceAccount:
kubectl create serviceaccount pear-sa -n pear-test-ns
kubectl get serviceaccount --all-namespaces -o wide
kubectl get serviceaccount -n pear-test-ns -o wide

kubectl describe serviceaccounts default -n pear-test-ns
kubectl describe serviceaccounts pear-sa -n pear-test-ns

kubectl describe pod pear-test-f67464f56-24p8d -n pear-test-ns

/var/run/secrets/kubernetes.io/serviceaccount

Role:
kubectl create role pods-reader --verb=get,list,watch --resource=pods --dry-run -o yaml
kubectl apply -f rbac.yaml
kubectl get role
kubectl describe role pods-reader

RoleBinding:
kubectl create rolebinding magedu-read-pods --role=pods-reader --user=magedu --dry-run -o yaml
kubectl get rolebindings
kubectl describe rolebindings magedu-read-pods

kubectl create rolebinding bob-admin-binding --clusterrole=admin --user=bob --namespace=acme
kubectl create rolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp --namespace=acme

ClusterRole:
ClusterRoleBinding:
kubectl create clusterrolebinding root-cluster-admin-binding --clusterrole=cluster-admin --user=root
kubectl create clusterrolebinding kubelet-node-binding --clusterrole=system:node --user=kubelet
kubectl create clusterrolebinding myapp-view-binding --clusterrole=view --serviceaccount=acme:myapp

StorageClass:


查所有使用到的容器:
kubectl get pods --all-namespaces -o jsonpath="{..image}" |\
tr -s '[[:space:]]' '\n' |\
sort |\
uniq -c

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL