发布一个k8s部署视频:https://edu.csdn.net/course/detail/26967
课程内容:各种k8s部署方式。包括minikube部署,kubeadm部署,kubeasz部署,rancher部署,k3s部署。包括开发测试环境部署k8s,和生产环境部署k8s。
腾讯课堂连接地址https://ke.qq.com/course/478827?taid=4373109931462251&tuin=ba64518
第二个视频发布 https://edu.csdn.net/course/detail/27109
腾讯课堂连接地址https://ke.qq.com/course/484107?tuin=ba64518
介绍主要的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等。
第三个视频发布:https://edu.csdn.net/course/detail/27574
详细介绍helm命令,学习helm chart语法,编写helm chart。深入分析各项目源码,学习编写helm插件
第四个课程发布:https://edu.csdn.net/course/detail/28488
本课程将详细介绍k8s所有命令,以及命令的go源码分析,学习知其然,知其所以然
------------------------------------------------------------------------------------------------------------
func newDependencyBuildCmd(out io.Writer) *cobra.Command {//创建dependency build命令
client := action.NewDependency()//初始化结构体
cmd := &cobra.Command{//创建cobra命令
Use: "build CHART",
Short: "rebuild the charts/ directory based on the Chart.lock file",
Long: dependencyBuildDesc,
Args: require.MaximumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
chartpath := "."//设置chartpath
if len(args) > 0 {//如果参数大于0个,则设置chartpath为第一个参数
chartpath = filepath.Clean(args[0])
}
man := &downloader.Manager{//构造manager
Out: out,
ChartPath: chartpath,
Keyring: client.Keyring,
Getters: getter.All(settings),
RepositoryConfig: settings.RepositoryConfig,
RepositoryCache: settings.RepositoryCache,
Debug: settings.Debug,
}
if client.Verify {//设置verify
man.Verify = downloader.VerifyIfPossible
}
return man.Build()//执行构造
},
}
f := cmd.Flags()
f.BoolVar(&client.Verify, "verify", false, "verify the packages against signatures")//verify选项
f.StringVar(&client.Keyring, "keyring", defaultKeyring(), "keyring containing public keys")//keyring选项
return cmd
}
func (m *Manager) Build() error {//执行构造
c, err := m.loadChartDir()//加载chart
if err != nil {
return err
}
// If a lock file is found, run a build from that. Otherwise, just do
// an update.
lock := c.Lock//获取lock
if lock == nil {//如果lock为空,执行更新
return m.Update()
}
// Check that all of the repos we're dependent on actually exist.
req := c.Metadata.Dependencies//获取依赖
if _, err := m.resolveRepoNames(req); err != nil {//解析依赖仓库名称
return err
}
if sum, err := resolver.HashReq(req, lock.Dependencies); err != nil || sum != lock.Digest {//判断hash是否相同
// If lock digest differs and chart is apiVersion v1, it maybe because the lock was built
// with Helm 2 and therefore should be checked with Helm v2 hash
// Fix for: https://github.com/helm/helm/issues/7233
if c.Metadata.APIVersion == chart.APIVersionV1 {//如果是v1版本api
log.Println("warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...")
if sum, err := resolver.HashV2Req(req); err != nil || sum != lock.Digest {//检查v2版本hash是否相同
return errors.New("the lock file (requirements.lock) is out of sync with the dependencies file (requirements.yaml). Please update the dependencies")//hash不同返回错误
}
} else {//如果是v3版本,返回错误
return errors.New("the lock file (Chart.lock) is out of sync with the dependencies file (Chart.yaml). Please update the dependencies")
}
}
// Check that all of the repos we're dependent on actually exist.
if err := m.hasAllRepos(lock.Dependencies); err != nil {//判断依赖仓库是否都存在
return err
}
if !m.SkipUpdate {//如果不跳过更新仓库
// For each repo in the file, update the cached copy of that repo
if err := m.UpdateRepositories(); err != nil {//更新仓库
return err
}
}
// Now we need to fetch every package here into charts/
return m.downloadAll(lock.Dependencies)//下载依赖
}