openshift oc使用管理员登录

添加kubeconfig的环境变量 KUBECONFIG=$(pwd)/openshift.local.config/master/admin.kubeconfig oc登录指定config文件 oc login -u system:admin -n default --config=$KUBECONFIG 使用管理员权限操作 oc your command --config=$KUBECONFIG Openshift常用操作: - oc delete DaemonSet --all : 删除所有DammonSet 查看编辑执行权 - oc get scc - oc edit scc restricted 项目赋权给用户 - oadm policy add-role-to-user admin \<user> -n \<project> 绑定主机 annotations: scheduler.alpha.kubernetes.io/affinity: >- {"nodeAffinity":{"requiredDuringSchedulingIgnoredDuringExecution":{"nodeSelectorTerms":[{"matchExpressions":[{"key":"kubernetes.io/hostname","operator":"In","values":["rdchitsm"]}]}]}}} 绑定主机目录 hostPath »

openshift使用pv和pvc

创建pv配置文件 vim t_pv.yml --- apiVersion: v1 kind: PersistentVolume metadata: labels: use: fluent-bit-config name: fluent-bit-config spec: accessModes: - ReadWriteMany capacity: storage: 10Mi nfs: path: /app/data/fluent-bit/config server: nfs.vinkdong.com 应用pv文件 oc apply -f t_pv.yml 查看是否成功创建 oc get pv fluent-bit-config 10Mi RWX Retain Bound ... 创建pvc: vim t-pvc.yml --- kind: PersistentVolumeClaim apiVersion: v1 metadata: name: fluent-bit-pvc spec: accessModes: - ReadWriteMany resources: requests: storage: 10Mi selector: matchLabels: use: fluent-bit-config 应用pvc oc apply -f t_pvc. »

docker Swarm,docker stack

docker使用自有集群Swarm使用场景较少,这里写个简单的示例,集群推荐使用kubernetes,docker在未来将原生支持kubernetes 启用Swarm docker swarm init --advertise-addr 192.168.99.100 加入一个工作节点 docker swarm join \ --token SWMTKN-1-22qet9fb8lhgmfj06dbz9pf6ed0g6y1hmug24xb9iosevpfgws-e3hfqm8e0lm73vnw83nxq720d \ 192.168.99.100:2377 生成Token docker swarm join-token manager 加入一个Manager节点 docker swarm join \ --token SWMTKN-1-22qet9fb8lhgmfj06dbz9pf6ed0g6y1hmug24xb9iosevpfgws-bl2esy7m2h9uwgl8xsyhhk96q \ 192.168.99.100:2377 编写stack.yml文件 version: '3.1' services: zoo1: image: zookeeper hostname: zoo1 ports: - 2181:2181 environment: ZOO_MY_ID: 1 ZOO_SERVERS: server.1=zoo1:2888:3888 server.2=zoo2:2888:3888 server.3=zoo3:2888:3888 zoo2: image: zookeeper hostname: zoo2 ports: - 2182:2181 environment: ZOO_MY_ID: 2 ZOO_SERVERS: server. »

docker使用socks proxy,docker使用shadowsocks代理

在linux中新建文件夹 mkdir /etc/systemd/system/docker.service.d 在docker.service.d文件夹中创建http-proxy.conf文件 [Service] Environment="ALL_PROXY=socks5://localhost:1080" # no socks5h 重新加载docker 守护进程 systemctl daemon-reload 查看是否生效 systemctl show --property=Environment docker 展示如下: Environment=HTTP_PROXY=socks5://localhost:1080 重启docker systemctl restart docker docker toolbox(windows 和mac系统) 在创建docker虚拟机时指定http_proxy=xxx »