为什么我们不能以命令式的方式创建PV或PVC?
尝试使用创建命令,但它没有显示任何一个。
kubectl create --help
Available Commands:
clusterrole Create a ClusterRole.
clusterrolebinding Create a ClusterRoleBinding for a particular ClusterRole
configmap Create a configmap from a local file, directory or literal value
cronjob Create a cronjob with the specified name.
deployment Create a deployment with the specified name.
ingress Create an ingress with the specified name.
job Create a job with the specified name.
namespace Create a namespace with the specified name
poddisruptionbudget Create a pod disruption budget with the specified …Run Code Online (Sandbox Code Playgroud) kubernetes kubectl persistent-volumes persistent-volume-claims kubernetes-pvc
我正在尝试使用 sshagent 插件部署到远程服务器。
当使用下面的语法时,我得到
pipeline {
agent any
stages {
stage('Deploy') {
steps {
sshagent(['nginx-ec2']) {
// some block
sh "ssh -o StrictHostKeyChecking=no ubuntu@<host_ip>"
sh "whoami"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
获取输出:
[Pipeline] sh (hide)
+ whoami
jenkins
Run Code Online (Sandbox Code Playgroud)
虽然我希望使用提供的凭据在远程服务器上运行脚本!
所以,我必须这样运行
pipeline {
agent any
stages {
stage('Deploy') {
steps {
sshagent(['nginx-ec2']) {
// some block
sh "ssh -o StrictHostKeyChecking=no -l ubuntu <host_ip> 'whoami && \
sudo apt update && sudo apt install -y docker.io && \
sudo usermod -aG docker …Run Code Online (Sandbox Code Playgroud)