现在我正在使用 yaml 文件在 k8s 上部署应用程序。
像下面一张:
apiVersion: v1
kind: Service
metadata:
name: serviceA
namespace: flow
spec:
ports:
- port: 8080
targetPort: 8080
selector:
app: serviceA
---
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: serviceA-ingress
namespace: flow
annotations:
nginx.ingress.kubernetes.io/use-regex: "true"
kubernetes.io/ingress.class: nginx
certmanager.k8s.io/cluster-issuer: letsencrypt-prod
nginx.ingress.kubernetes.io/rewrite-target: /
spec:
tls:
- hosts:
- serviceA.xyz.com
secretName: letsencrypt-prod
rules:
- host: serviceA.xyz.com
http:
paths:
- path: /
backend:
serviceName: serviceA
servicePort: 8080
---
apiVersion: v1
kind: ConfigMap
metadata:
name: serviceA-config
namespace: flow
data:
application-dev.properties: |
spring.application.name=serviceA-main …Run Code Online (Sandbox Code Playgroud) 我是 DevOps 的新手。我为刚刚在 Digital Oceans 上创建的 Kubernetes 集群编写了一个 deployment.yaml 文件。创建部署不断出现我现在无法解码的错误。这只是一个测试部署,为我公司的 Web 应用程序迁移到 kubernetes 做准备。
我尝试编辑部署的内容,使其看起来像我发现的常规示例。我什至无法让这个简单的例子起作用。您可以在下面找到 deployment.yaml 内容。
---
kind: Deployment
apiVersion: apps/v1
metadata:
name: testit-01-deployment
spec:
replicas: 4
#number of replicas generated
selector:
#assigns labels to the pods for future selection
matchLabels:
app: testit
version: v01
template:
metadata:
Labels:
app: testit
version: v01
spec:
containers:
-name: testit-container
image: teejayfamo/testit
ports:
-containerPort: 80
Run Code Online (Sandbox Code Playgroud)
我在文件夹容器中的 cmd 上运行了这一行:
kubectl apply -f deployment.yaml --validate=false
来自服务器的错误(BadRequest):创建“deployment.yaml”时出错:版本“v1”中的部署不能作为部署处理:v1.Deployment.Spec:v1.DeploymentSpec.Template:v1.PodTemplateSpec.Spec:v1.PodSpec .Containers: []v1.Container: decode slice: expect [ or n, but …
我使用hashicorp打包器来构建烘焙的VM映像.
但是想知道linuxkit也做同样的事情,我的意思是建立烘焙的VM图像,唯一的区别是更多的容器和内核中心.
想知道这两者的工作与用例之间的确切区别.
使用packer和linuxkit也可以有任何用例.
有没有办法排除某些命名空间fluent-bit?我想排除某些命名空间,因此fluent-bit不会将在这些命名空间中创建的所有日志转发到 ELK。
除了为该命名空间中的每个 pod 添加注释之外,还有其他方法吗?我知道您可以通过 kubectl 更新命名空间中的所有 pod 注释。
kubectl annotate pods --namespace=pks-system --all fluentbit.io/exclude='true'
我正在从事在线书店项目。我正在尝试在 dockercompose.yml 中设置环境变量
project_folder/settings.py
SECRET_KEY = os.environ.get('SECRET_KEY')
dockercompose.yml 文件中的代码
version: '3.7'
services:
web:
build: .
command: python /code/manage.py runserver 0.0.0.0:8000
volumes:
- .:/code
ports:
- 8000:8000
depends_on:
- db
environment:
- SECRET_KEY=my_secret_key
- DEBUG=1
db:
image: postgres:11
volumes:
- postgres_data:/var/lib/postgresql/data/
volumes:
postgres_data:
Run Code Online (Sandbox Code Playgroud)
运行命令时出现以下错误
$docker-compose down
ERROR: Invalid interpolation format for "environment" option in service "web": "SECRET_KEY=my_secret_key"
Run Code Online (Sandbox Code Playgroud) 我必须设置export PATH=~/.local/bin:$PATH. 只要我docker exec -it <container> bash手动完成它就可以了。但是,我尝试将其自动化.dockerfile:
FROM jupyter/scipy-notebook
RUN conda install --yes -c conda-forge fbprophet
ENV PATH="~/.local/bin:${PATH}"
RUN pip install awscli --upgrade --user
Run Code Online (Sandbox Code Playgroud)
似乎ENV PATH="~/.local/bin:${PATH}"与我在这里收到的警告的效果不同。你看到我做错了什么了吗?
WARNING: The scripts pyrsa-decrypt, pyrsa-decrypt-bigfile, pyrsa-encrypt, pyrsa-encrypt-bigfile, pyrsa-keygen, pyrsa-priv2pub, pyrsa-sign and pyrsa-verify are installed in '/home/jovyan/.local/bin' which is not on PATH.
Run Code Online (Sandbox Code Playgroud) 我遇到过这样一种情况,突然发生很长的 GC 暂停,我需要找出突然内存分配的根源是什么。长时间的 GC 暂停(大约 30 秒)会导致 pod 连续多次 K8s 健康检查失败,并且 pod 会重新启动,而实际上并没有发生 OOM。我想在 K8s 实际重新启动 pod 之前创建堆转储。我意识到应该对某些外部持久安装进行转储。
我对如何导致堆转储发生的唯一想法是使用 preStop 挂钩。问题是,pod因健康检查失败而重启时,preStop钩子是否会被触发?
也许有一个更优雅的解决方案?
我正在尝试覆盖基于 alpine 的 pod 的 dnsconfig(特别是搜索域)。
但dnsconfig似乎在 pod 对象中可用。
无论如何,是否可以在部署对象中提供 dnsconfig 或任何其他解决方法来覆盖该特定 pod 的 searchdomain。
我正在使用 MVC 节点表达 pug 和续集作为 ORM 处理节点中的待办事项列表,而视图部分是我用 pug 制作的,所以当我启动我的应用程序时工作正常,但是当我尝试创建一个新项目时,这个项目就消失了插入数据库时出现错误 1364
原则上,这是一个添加到我的投资组合中的个人项目,我看到通过停用 STRICT SQL 模式有一个可能的解决方案,但我想知道是否还有其他解决方案
model code Proyect.js
const Sequelize = require('sequelize');
//conect db
const db = require('../config/db');
const Proyects = db.define('proyects', {
id: {
type: Sequelize.INTEGER,
primaryKey: true,
autoIncrement: true,
allowNull: false
},
name: Sequelize.STRING,
url: Sequelize.STRING
});
module.exports = Proyects;
Run Code Online (Sandbox Code Playgroud)
我希望使用这个模型在我的表中创建一个寄存器,但是当我尝试实际错误时,它是下一个
Executing (default): CREATE TABLE IF NOT EXISTS `proyects` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(255), `url` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY …Run Code Online (Sandbox Code Playgroud) 我在 Windows 10 Pro 计算机上使用 Docker(Linux 容器)。我创建了一个 docker 容器来运行我的 Flask 应用程序,并在 requests.txt 文件中提到了所需的库。
当我运行 docker 容器时,我收到以下消息
OSError:ctypes.util.find_library()无法找到名为“sndfile”的库。
如何在 Docker 中安装 sndfile 库?
参考链接:https://pysoundfile.readthedocs.io/en/0.9.0/ 我尝试在 Dockerfile 中使用以下命令安装 libsndfile
---- RUN apt-get install libsndfile1
Got Below message from docker build:
Step 5/7 : RUN apt-get install libsndfile1
---> Running in <container>
Reading package lists...
Building dependency tree...
Reading state information...
E: Unable to locate package libsndfile1
The command '/bin/sh -c apt-get install libsndfile1' returned a non-zero code: 100
Run Code Online (Sandbox Code Playgroud)
1.Docker版本:
Client:
Version: …Run Code Online (Sandbox Code Playgroud) docker ×6
kubernetes ×5
alpine-linux ×1
coredns ×1
deployment ×1
django ×1
dns ×1
dockerfile ×1
express ×1
fluent-bit ×1
heap-dump ×1
java ×1
jvm ×1
libsndfile ×1
mysql ×1
node.js ×1
packer ×1
sequelize.js ×1
yaml ×1