課程內容:各種k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括開發測試環境部署k8s,和生產環境部署k8s。
介紹主要的k8s資源的使用配置和命令。包括configmap,pod,service,replicaset,namespace,deployment,daemonset,ingress,pv,pvc,sc,role,rolebinding,clusterrole,clusterrolebinding,secret,serviceaccount,statefulset,job,cronjob,poddisruptionbudget,podsecuritypolicy,networkpolicy,resourcequota,limitrange,endpoint,event,conponentstatus,node,apiservice,controllerrevision等。
詳細介紹helm命令,學習helm chart語法,編寫helm chart。深入分析各專案原始碼,學習編寫helm外掛程式
第四個課程發布:
本課程將詳細介紹k8s所有命令,以及命令的go原始碼分析,學習知其然,知其所以然
}
//建立undo命令
func newcmdrolloutundo(f cmdutil.factory, streams genericclioptions.iostreams) *cobra.command
cmd := &cobra.command,
validargs: validargs,//有效引數
} cmd.flags().int64var(&o.torevision, "to-revision", o.torevision, "the revision to rollback to. default to 0 (last revision).")//to-revision選項
usage := "identifying the resource to get from a server."
cmdutil.addfilenameoptionflags(cmd, &o.filenameoptions, usage)//檔案選項
cmdutil.adddryrunflag(cmd)//幹跑選項
o.printflags.addflags(cmd)//列印選項
return cmd
}
//準備函式
func (o *undooptions) complete(f cmdutil.factory, cmd *cobra.command, args string) error
o.toprinter = func(operation string) (printers.resourceprinter, error)
return o.printflags.toprinter()
} o.restclientgetter = f//設定restclientgetter
o.builder = f.newbuilder//設定builder
return err
}//校驗函式
func (o *undooptions) validate() error
return nil
}
//執行
func (o *undooptions) runundo() error
err := r.visit(func(info *resource.info, err error) error
if err != nil
result, err := rollbacker.rollback(info.object, nil, o.torevision, o.dryrun)//執行回滾
if err != nil
printer, err := o.toprinter(result)//print flag轉printer
if err != nil
return printer.printobj(info.object, o.out)//列印結果
}) return err
}
//執行回滾
func (r *deploymentrollbacker) rollback(obj runtime.object, updatedannotations map[string]string, torevision int64, dryrun bool) (string, error)
accessor, err := meta.accessor(obj)//訪問物件
if err != nil
name := accessor.getname()//獲取obj名稱
namespace := accessor.getnamespace()//獲取obj namespace
// todo: fix this after kubectl has been removed from core. it is not possible to convert the runtime.object
// here. this follows the same pattern as for daemonset and statefulset.
if err != nil
rsforrevision, err := deploymentrevision(deployment, r.c, torevision)//獲取對應版本的rs
if err != nil
if dryrun
if deployment.spec.paused
// skip if the revision already matches current deployment
if equalignorehash(&rsforrevision.spec.template, &deployment.spec.template)
// remove hash label before patching back into the deployment
// compute deployment annotations
annotations := map[string]string{}//設定annotation
for k := range annotationstoskip
} for k, v := range rsforrevision.annotations
} // make patch to restore
patchtype, patch, err := getdeploymentpatch(&rsforrevision.spec.template, annotations)//獲取patch
if err != nil
// restore revision
return "", fmt.errorf("failed restoring revision %d: %v", torevision, err)
} return rollbacksuccess, nil//返回成功
}
kubectl原始碼分析之auth can i
課程內容 各種k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括開發測試環境部署k8s,和生產環境部署k8s。介紹主要的k8s資源的使用配置和命令。包括configmap,pod,service,replicaset,namespa...
kubectl原始碼分析之kustomize
istio多集群探秘,部署了50次多集群後我得出的結論 istio防故障利器,你知道幾個,istio新手不要讀,太難!istio業務許可權控制,原來可以這麼玩 istio實現非侵入壓縮,微服務之間如何實現壓縮 不懂envoyfilter也敢說精通istio系列 http rbac 不要只會用auth...
原始碼分析之LayoutInflater
簡介 inflate填充的過程 viewstub,merge,include的載入過程 layoutinflater系統服務的註冊過程 systemserviceregistry類有個靜態 塊,完成了常用服務的註冊,如下 static 註冊am registerservice context.act...