Practical DevOps Commands, CI/CD Automation & IaC: Terraform + Kubernetes Workflows


Warning: Trying to access array offset on value of type bool in /home/et001/public_html/piotro-stal.pl/wp-content/themes/betheme/betheme/functions/theme-functions.php on line 1338

Warning: Trying to access array offset on value of type bool in /home/et001/public_html/piotro-stal.pl/wp-content/themes/betheme/betheme/functions/theme-functions.php on line 1343
How to Claim & Verify Your Project Listing (Spark/GitHub)
1 lipca, 2025
React toast: lightweight notifications, setup, hooks & customization
15 sierpnia, 2025

Warning: Trying to access array offset on value of type bool in /home/et001/public_html/piotro-stal.pl/wp-content/themes/betheme/betheme/functions/theme-functions.php on line 1338

Warning: Trying to access array offset on value of type bool in /home/et001/public_html/piotro-stal.pl/wp-content/themes/betheme/betheme/functions/theme-functions.php on line 1343





DevOps Commands & CI/CD: Terraform, Kubernetes, IaC Workflows



Quick summary: actionable commands, pipeline patterns, container orchestration tips, and secure IaC practices to run production-grade cloud workloads.

Core DevOps commands and CI/CD pipelines automation

Start with the fundamentals: shell commands, package managers, git workflows, and a few CI/CD primitives that scale. The day-to-day DevOps toolkit typically includes git (branching and merge strategies), container tooling like docker and kubectl, CI/CD runners (GitHub Actions, GitLab CI, CircleCI), and scripting languages for orchestration (Bash, Python, or Go).

For CI/CD automation, focus on idempotent, atomic steps: checkout, lint/test, build, image-push, manifest-template, deploy, and smoke-test. Each step should return clear exit codes and logs so runners can make deterministic decisions. Pipeline templates—YAML or HCL—help standardize promotion from dev to prod.

Example primitives you’ll use daily: git checkout -b feature/x, docker build -t myapp:latest ., kubectl apply -f k8s/, and pipeline snippets like a GitHub Actions job that runs tests and pushes an image. If you want a curated set of scripts and examples, see the DevOps commands collection repository for ready-to-adapt snippets and CI templates.

Container orchestration tools, Terraform and Kubernetes manifests in practice

Container orchestration is the coordination layer: scheduling, service discovery, rolling updates, and resource guarantees. Kubernetes remains the de facto choice, so you should be fluent in manifests, Helm charts, and kustomize overlays. Write declarative manifests that follow the principle of least privilege and avoid imperative kubectl commands for long-term state changes.

Infrastructure as Code (IaC) sits at the intersection of provisioning and repeatability. Terraform excels for cloud resource lifecycle management—VPCs, IAM, managed K8s clusters—while Kubernetes manifests manage the runtime. Use Terraform to provision the cluster and Helm or Kustomize to declare workloads. Keep the state remote (e.g., S3 + DynamoDB locking) and modularize modules for reuse.

Practical tip: generate manifests from templates using a CI step, validate with kubeval or conftest, and run blue/green or canary deployments via your orchestrator or service mesh. For hands-on examples of combining Terraform and Kubernetes manifests, check the repository of scripts and templates at Terraform and Kubernetes manifests.

Monitoring, incident response, and security scanning in DevOps workflows

Monitoring and observability are non-negotiable. Instrument applications with metrics (Prometheus), tracing (OpenTelemetry/Jaeger), and structured logs (ELK/EFK). Alerts should be meaningful, actionable, and routed through runbooks. Design SLOs and error budgets before optimizing for 99.999%—you’ll trade velocity against reliability explicitly.

Incident response combines tooling and process: automated alert enrichment, incident tracking, and postmortems. Use mutable runbooks stored in the same repo as your automation (versioned IaC and runbooks together) and automate escalation flows via PagerDuty or Opsgenie. Ensure your CI/CD pipelines include a pre-deploy canary stage to reduce blast radius.

Security scanning must be integrated in pipeline gates: static code analysis, dependency vulnerability scanning (Snyk, Dependabot), container image scanning (Trivy, Clair), and IaC security checks (Tfsec, Checkov). Fail fast on high-severity findings, and track remediation as part of sprint work to avoid technical debt compounding into compliance debt.

Cloud infrastructure workflows and best practices

Cloud workflows hinge on automation, least-privilege access, cost-awareness, and repeatability. Treat cloud accounts as immutable environments: infrastructure changes come through pull requests to IaC modules, with automated plan previews and peer review. Use short-lived credentials and OIDC where available to avoid long-lived secrets in CI environments.

Promote environments with clear promotion gates: dev → staging → prod. Each promotion should run acceptance tests, security scans, and performance baselines. Automate rollbacks using immutable artifacts (immutable container tags) and use deployment strategies appropriate to the service criticality—canary for web frontends, rolling updates for background workers.

Cost governance belongs in pipelines too: tag resources automatically, run periodic cost scans, and enforce quotas via policy-as-code. When possible, automate idle resource shutdowns and use rightsizing recommendations as a scheduled pipeline step to control runaway bills.

Semantic core — primary, secondary, and clarifying keyword clusters

This semantic core was built to match intent across technical search queries, voice queries, and featured-snippet patterns. Use these clusters to optimize headings, first-paragraph answers, and FAQ snippets for voice search.

  • Primary: DevOps commands collection; CI/CD pipelines automation; container orchestration tools; infrastructure as code; Terraform and Kubernetes manifests; monitoring and incident response; cloud infrastructure workflows; security scanning DevOps.
  • Secondary: kubectl commands, docker build push, GitHub Actions CI, GitLab CI templates, Helm charts, kustomize overlays, Terraform modules, IaC best practices, Prometheus alerting, SLOs and SLIs.
  • Clarifying / LSI: automated deployments, canary deployment example, trivy image scanning, tfsec policies, OIDC for CI, remote Terraform state, image vulnerability scanning, infra drift detection, blue-green deployment, continuous delivery vs continuous deployment.

Apply the primary keywords in the H1/H2 and first 100 words; sprinkle secondary phrases in subheads and technical examples; use clarifying/LSI phrases in captions, code comments, and FAQ answers for natural language coverage that satisfies semantic search.

Popular user questions discovered (People Also Ask & forums)

These reflect the most frequent practical queries engineers ask when building pipelines and IaC. The top items are ideal candidates for FAQ and featured snippets.

  • How do I structure CI/CD pipelines for Terraform and Kubernetes?
  • Which commands are essential for daily Kubernetes operations?
  • How to scan container images in CI for vulnerabilities?
  • What is the best way to manage Terraform state in teams?
  • How to implement canary or blue/green deployments in Kubernetes?
  • What pipelines enforce security scanning without blocking developer flow?
  • How to automate rollback on failed deployments?

FAQ — concise, search-optimized answers

How do I structure CI/CD pipelines for Terraform and Kubernetes?

Structure pipelines as discrete stages: validate (lint + security checks), plan (Terraform plan or manifest render), approve (manual approval for prod), apply (Terraform apply for infra or kubectl/Helm deploy for workloads), and post-deploy tests. Keep state remote and use automated plan previews in PRs so reviewers can see the exact delta before changes merge. For example pipelines and templates, refer to the CI/CD and IaC examples.

Which commands are essential for daily Kubernetes operations?

Essential commands include kubectl get|describe|logs|exec for diagnostics, kubectl apply and kubectl rollout status for deployments, and kubectl port-forward for local debugging. Combine these with kubectl diff or kubeval validations in CI to prevent accidental drift. Keep short aliases and scripts to reduce typing errors in production.

How to scan container images in CI for vulnerabilities?

Integrate an image scanner (Trivy, Clair, or Aqua) as a pipeline stage that runs after image build and before push. Configure severity thresholds and fail builds on critical/high findings, but provide a triage workflow so teams can add exceptions when verified. Store scan results and expose them in dashboards or PR checks for easy remediation tracking.

Micro-markup and schema suggestions

To maximize SERP real estate and voice search reach, add JSON-LD for the FAQ and basic Article markup. Below is ready-to-insert JSON-LD for the FAQ used above. Add it to the page head or just before the closing body tag.

{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "How do I structure CI/CD pipelines for Terraform and Kubernetes?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Structure pipelines as validate, plan, approve, apply, and post-deploy tests. Use remote state, automated plan previews in PRs, and separate infra vs workload steps."
      }
    },
    {
      "@type": "Question",
      "name": "Which commands are essential for daily Kubernetes operations?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Use kubectl for get, describe, logs, exec, apply, rollout status and port-forward; combine with validation tools like kubeval in CI."
      }
    },
    {
      "@type": "Question",
      "name": "How to scan container images in CI for vulnerabilities?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "Run Trivy or Clair as a CI stage after image build and before push; fail on critical issues and track results in dashboards or PR checks."
      }
    }
  ]
}

Optionally add an Article schema with headline, description, and author to help Google understand the page and surface it as a knowledge panel candidate.

Quick reference & backlinks

Want an actionable repo with scripts, CI snippets, and manifest examples you can fork and adapt? Browse the curated collection at DevOps commands collection. For integrated examples combining provisioning and workloads, see the examples labeled Terraform and Kubernetes manifests in the same repository.

Use those examples to seed your own CI/CD automation and enforce policy-as-code checks across pipelines. Fork, adapt, test in a sandbox, and gradually promote to production following canary strategies.

If you want, I can convert any of the pipeline examples in this guide into a ready-to-run GitHub Actions or GitLab CI template tailored to your cloud provider and cluster topology.




This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny