init commit

This commit is contained in:
2024-03-19 01:05:51 +08:00
commit 199bbf2628
393 changed files with 34883 additions and 0 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

View File

@ -0,0 +1,58 @@
entrypoint是容器执行的命令cmd是执行的命令或者参数.
```bash
docker run --entrypoint /bin/bash test bash
# 覆盖ENTRYPOINT 覆盖CMD
```
```dockerfile
ENTRYPOINT ["/bin/echo", "hello"]
CMD ["world"]
```
![image-20210114105711640](entrypoint.assets/image-20210114105711640.png)
像这样执行结果是:`Hello world`
覆盖CMD的参数
```bash
docker run test eicas
```
![image-20210114111521900](entrypoint.assets/image-20210114111521900.png)
感觉就像是将两个命令拼接起来
### 在k8s中的对应
[k8s文档地址](https://kubernetes.io/zh/docs/tasks/inject-data-application/define-command-argument-container/#notes)
![image-20210114112244500](entrypoint.assets/image-20210114112244500.png)
### CMD和ENTRYPOINT执行的两种形式
```dockerfile
CMD "命令/参数"
# 以shell执行,相当于会自动补全"/bin/sh -c ",等价于CMD ["/bin/sh -c ","\"命令/参数\""],ENTRYPOINT也是如此
```
![image-20210114112052386](entrypoint.assets/image-20210114112052386.png)
![image-20210114105605169](https://i.loli.net/2021/01/14/6LMPTFvfbrkXjd1.png)
![image-20210114111116997](entrypoint.assets/image-20210114111116997.png)
ENTRYPOINT的shell方式下,无法接受参数
![image-20210114111300414](entrypoint.assets/image-20210114111300414.png)
```dockerfile
CMD ["命令/参数","命令/参数"]
# 以exec形式执行
```
![image-20210114105711640](entrypoint.assets/image-20210114105711640.png)

View File

@ -0,0 +1,68 @@
> 最终还是放弃了使用wsl2和docker来运行k8s,安装了虚拟机来使用,后续可能尝试在本地连接虚拟机环境的docker来在本地用docker.
> 主要还是因为wsl2不够完善systemctl不能使用,我这小菜鸡不知道怎么去解决了,docker for desktop的k8s时好时坏.还是虚拟机好使一点...
### 安装虚拟机
我使用的是`VirtualBox`,安装我已经安装好了,网络使用的是桥接,其他没什么可注意的,正常安装,这里我用的是centos.CPU-->2 MEM-->4G
![](../../img/screen/}]6J69Q}FQCLI]E]}L5F$TG.png)
### 安装docker
> 用这些工具安装都是很简单的,主要是网络的问题(我只创建了root账号,所以后面的没有用sudo,用了sudo反而不能用代理,没管那么多了)
按照[https://docs.docker.com/install/linux/docker-ce/centos/](https://docs.docker.com/install/linux/docker-ce/centos/)的来就好了
```bash
export https_proxy=http://proxyip:port
yum install -y yum-utils \
device-mapper-persistent-data \
lvm2
yum-config-manager \
--add-repo \
https://download.docker.com/linux/centos/docker-ce.repo
yum install docker-ce docker-ce-cli containerd.io
systemctl start docker
# test
docker run hello-world
```
### 设置docker代理
[https://docs.docker.com/config/daemon/systemd/](https://docs.docker.com/config/daemon/systemd/)
```bash
mkdir -p /etc/systemd/system/docker.service.d
vi /etc/systemd/system/docker.service.d/https-proxy.conf
### 输入(和之前的一样)
[Service]
Environment="HTTPS_PROXY=http://proxyip:port"
###
systemctl daemon-reload
systemctl restart docker
systemctl show --property=Environment docker
```
### 然后是minikube
> 主要是代理配置好,就没什么问题,哪里慢也可以配置代理提高速度
#### 获取kubectl和minikunbe
```bash
curl -LO https://storage.googleapis.com/kubernetes-release/release/$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt)/bin/linux/amd64/kubectl && chmod +x kubectl && mv kubectl /usr/local/bin/
curl -Lo minikube https://storage.googleapis.com/minikube/releases/v1.3.0/minikube-linux-amd64 && chmod +x minikube && cp minikube /usr/local/bin/ && rm minikube
```
#### start
```
minikube start --vm-driver=none
```
如果中间有失败的可以删除minikube再重新上面的步骤(尝试记得做快照)
```bash
rm ~/.minikube/ ~/.kube -rf
```
这样就算成功了
![](../../img/screen/VV68]}9Y0F4LGCF]I$P\({6M.png)
- -...弄好干啥,暂时不知道,先弄好吧

View File

@ -0,0 +1,40 @@
### minikube安装之后 kubectl get node 无效
需要移除http_proxy不要使用代理
### nginx无法反代其他端口
查看日志:
connect() to 127.0.0.1:8080 failed (13: Permission denied)
解决:
修改SeLinux
```bash
setsebool -P httpd_can_network_connect 1
```
### minikube安装面板无法访问
报错Error while initializing connection to Kubernetes apiserver. This most likely means that the cluster is misconfigured (e.g., it has invalid apiserver certificates or service account's configuration) or the --apiserver-host param points to a server that does not exist. Reason: Get https://10.96.0.1:443/version: dial tcp 10.96.0.1:443: connect: no route to host
Refer to our FAQ and wiki pages for more information: https://github.com/kubernetes/dashboard/wiki/FAQ
解决:
https://blog.csdn.net/shida_csdn/article/details/80028905
```bash
# systemctl stop kubelet
# systemctl stop docker
# iptables --flush
# iptables -tnat --flush
# systemctl start kubelet
# systemctl start docker
```
### docker私有仓库
需要在 /etc/docker/certs.d 下建立域名为名称的文件夹,放入ca.crt证书
### golang module私有仓库
> 当天就更新了go1.13
主要是设置git的(注意配置.ssh秘钥之类)
```
[url "ssh://git@xxxxx"]
insteadOf = https://xxxx
```
私有仓库参考文章:https://mp.weixin.qq.com/s?__biz=MzU3Mzk5OTk1OQ==&mid=2247483702&idx=1&sn=d2a97191cec84ca59a3c63c7de273aeb&chksm=fd385f0eca4fd618dbb63bc01e50297a075663e8f6b401fe9171fa69fae9bd088de67f1fbe9b&mpshare=1&scene=23&srcid=0905LuIt21jXoWgVuNwcdzRO&sharer_sharetime=1567642857821&sharer_shareid=8b453be2580fa2f2bbcdf77f41134328#rd

View File

@ -0,0 +1,59 @@
> 在虚拟机内进行调试,肯定没有本机的wsl和docker那么方便,不过总是有办法的
### VSCode
> vscode 提供了远程连接的插件`Visual Studio Code Remote - SSH`
然后新建一个连接就好了,然后新建的vscode就完全处在远程的环境中了
![](../../img/screen/OH1IUV3NV\(LH7U\]H8N0WZ_E.png)
config内容:
```bash
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host centos
HostName 虚拟机ip
User root
```
然后比较烦的就是每次打开都需要输入密码,我们可以用我们的公钥登录(git那个)
```bash
mkdir .ssh
chmod 700 .ssh/
touch ~/.ssh/authorized_keys
chmod 600 ~/.ssh/authorized_keys
vi ~/.ssh/authorized_keys
### 这里我们直接吧id_rsa.pub复制粘贴上传上去- -...用xshell之类的工具去粘贴
```
config后面增加`IdentityFile`,然后就完事了
```bash
# Read more about SSH config files: https://linux.die.net/man/5/ssh_config
Host centos
HostName 虚拟机ip
User root
IdentityFile ~/.ssh/id_rsa
```
不过就是还要重新建立环境
### docker(vscode)
安装微软的那个docker插件,然后进入首选项,修改如下配置
![](../../img/screen/6UVI\)HI6]~QXP33OMNWYSAF.png)
在虚拟机中允许docker远程访问
```bash
vi /usr/lib/systemd/system/docker.service
### 修改文件
[Service]
ExecStart=/usr/bin/dockerd -H fd:// -H tcp://0.0.0.0:2375 --containerd=/run/containerd/containerd.sock
### 上面这一行,主要是增加了`-H tcp://0.0.0.0:2375`
systemctl daemon-reload
systemctl restart docker
### 如果连不上,关闭防火墙,直接关!
systemctl stop firewalld
### 算了,只打开docker的端口
firewall-cmd --zone=public --add-port=2375/tcp --permanent
```
### idea系列
![](../../img/screen/7AOA\[T4P2V`Y9O3E9AR6~YN.png)
直接上图